Use "#pragma once" to prevent repeated header file inclusion

This commit is contained in:
Eelco Dolstra 2012-07-18 14:59:03 -04:00
parent 58337e0e61
commit b7fd2c2822
32 changed files with 31 additions and 166 deletions

4
.gitignore vendored
View File

@ -78,13 +78,9 @@ Makefile.in
/src/libexpr/parser-tab.cc
/src/libexpr/parser-tab.hh
/src/libexpr/parser-tab.output
/src/libexpr/nixexpr-ast.hh
/src/libexpr/nixexpr-ast.cc
/src/libexpr/nix.tbl
# /src/libstore/
/src/libstore/derivations-ast.cc
/src/libstore/derivations-ast.hh
/src/libstore/schema.sql.hh
# /src/nix-env/

View File

@ -1,20 +1,13 @@
#ifndef __ATTR_PATH_H
#define __ATTR_PATH_H
#pragma once
#include "eval.hh"
#include <string>
#include <map>
namespace nix {
void findAlongAttrPath(EvalState & state, const string & attrPath,
Bindings & autoArgs, Expr * e, Value & v);
}
#endif /* !__ATTR_PATH_H */

View File

@ -1,9 +1,7 @@
#ifndef __COMMON_OPTS_H
#define __COMMON_OPTS_H
#pragma once
#include "eval.hh"
namespace nix {
/* Some common option parsing between nix-env and nix-instantiate. */
@ -17,6 +15,3 @@ bool parseSearchPathArg(const string & arg, Strings::iterator & i,
Path lookupFileArg(EvalState & state, string s);
}
#endif /* !__COMMON_OPTS_H */

View File

@ -1,5 +1,4 @@
#ifndef __EVAL_INLINE_H
#define __EVAL_INLINE_H
#pragma once
#include "eval.hh"
@ -8,7 +7,6 @@
namespace nix {
LocalNoInlineNoReturn(void throwEvalError(const char * s))
{
throw EvalError(s);
@ -55,7 +53,4 @@ inline void EvalState::forceList(Value & v)
throwTypeError("value is %1% while a list was expected", showType(v));
}
}
#endif /* !__EVAL_INLINE_H */

View File

@ -1,5 +1,4 @@
#ifndef __EVAL_H
#define __EVAL_H
#pragma once
#include "value.hh"
#include "nixexpr.hh"
@ -256,6 +255,3 @@ string showType(const Value & v);
}
#endif /* !__EVAL_H */

View File

@ -1,5 +1,4 @@
#ifndef __GET_DRVS_H
#define __GET_DRVS_H
#pragma once
#include "eval.hh"
@ -78,6 +77,3 @@ void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
}
#endif /* !__GET_DRVS_H */

View File

@ -1,12 +1,9 @@
#ifndef __NAMES_H
#define __NAMES_H
#pragma once
#include "types.hh"
namespace nix {
struct DrvName
{
string fullName;
@ -19,15 +16,9 @@ struct DrvName
bool matches(DrvName & n);
};
typedef list<DrvName> DrvNames;
int compareVersions(const string & v1, const string & v2);
DrvNames drvNamesFromArgs(const Strings & opArgs);
}
#endif /* !__NAMES_H */

View File

@ -1,5 +1,4 @@
#ifndef __NIXEXPR_H
#define __NIXEXPR_H
#pragma once
#include "value.hh"
#include "symbol-table.hh"
@ -290,6 +289,3 @@ struct StaticEnv
}
#endif /* !__NIXEXPR_H */

View File

@ -1,5 +1,4 @@
#ifndef __SYMBOL_TABLE_H
#define __SYMBOL_TABLE_H
#pragma once
#include "config.h"
@ -88,5 +87,3 @@ public:
};
}
#endif /* !__SYMBOL_TABLE_H */

View File

@ -1,5 +1,4 @@
#ifndef __VALUE_TO_XML_H
#define __VALUE_TO_XML_H
#pragma once
#include "nixexpr.hh"
#include "eval.hh"
@ -13,5 +12,3 @@ void printValueAsXML(EvalState & state, bool strict, bool location,
Value & v, std::ostream & out, PathSet & context);
}
#endif /* !__VALUE_TO_XML_H */

View File

@ -1,5 +1,4 @@
#ifndef __VALUE_H
#define __VALUE_H
#pragma once
#include "symbol-table.hh"
@ -151,5 +150,3 @@ void mkPath(Value & v, const char * s);
}
#endif /* !__VALUE_H */

View File

@ -1,5 +1,4 @@
#ifndef __SHARED_H
#define __SHARED_H
#pragma once
#include "util.hh"
@ -54,6 +53,3 @@ extern int exitCode;
extern char * * argvSaved;
}
#endif /* !__SHARED_H */

View File

@ -1,5 +1,4 @@
#ifndef __DERIVATIONS_H
#define __DERIVATIONS_H
#pragma once
#include <map>
@ -81,6 +80,3 @@ typedef std::map<Path, Hash> DrvHashes;
extern DrvHashes drvHashes;
}
#endif /* !__DERIVATIONS_H */

View File

@ -1,5 +1,4 @@
#ifndef __GLOBALS_H
#define __GLOBALS_H
#pragma once
#include "types.hh"
@ -118,6 +117,3 @@ void setDefaultsFromEnvironment();
}
#endif /* !__GLOBALS_H */

View File

@ -1,5 +1,4 @@
#ifndef __LOCAL_STORE_H
#define __LOCAL_STORE_H
#pragma once
#include <string>
@ -302,6 +301,3 @@ void deletePathWrapped(const Path & path,
void deletePathWrapped(const Path & path);
}
#endif /* !__LOCAL_STORE_H */

View File

@ -1,5 +1,4 @@
#ifndef __MISC_H
#define __MISC_H
#pragma once
#include "derivations.hh"
@ -35,6 +34,3 @@ void queryMissing(StoreAPI & store, const PathSet & targets,
}
#endif /* !__MISC_H */

View File

@ -1,5 +1,4 @@
#ifndef __PATHLOCKS_H
#define __PATHLOCKS_H
#pragma once
#include "types.hh"
@ -44,6 +43,3 @@ bool pathIsLockedByMe(const Path & path);
}
#endif /* !__PATHLOCKS_H */

View File

@ -1,5 +1,4 @@
#ifndef __REFERENCES_H
#define __REFERENCES_H
#pragma once
#include "types.hh"
#include "hash.hh"
@ -10,5 +9,3 @@ PathSet scanForReferences(const Path & path, const PathSet & refs,
HashResult & hash);
}
#endif /* !__REFERENCES_H */

View File

@ -1,5 +1,4 @@
#ifndef __REMOTE_STORE_H
#define __REMOTE_STORE_H
#pragma once
#include <string>
@ -101,6 +100,3 @@ private:
}
#endif /* !__REMOTE_STORE_H */

View File

@ -1,5 +1,4 @@
#ifndef __STOREAPI_H
#define __STOREAPI_H
#pragma once
#include "hash.hh"
#include "serialise.hh"
@ -356,6 +355,3 @@ MakeError(BuildError, Error) /* denotes a permanent build failure */
}
#endif /* !__STOREAPI_H */

View File

@ -1,6 +1,4 @@
#ifndef __WORKER_PROTOCOL_H
#define __WORKER_PROTOCOL_H
#pragma once
namespace nix {
@ -64,6 +62,3 @@ template<class T> T readStorePaths(Source & from);
}
#endif /* !__WORKER_PROTOCOL_H */

View File

@ -1,5 +1,4 @@
#ifndef __ARCHIVE_H
#define __ARCHIVE_H
#pragma once
#include "types.hh"
#include "serialise.hh"
@ -74,6 +73,3 @@ void restorePath(const Path & path, Source & source);
}
#endif /* !__ARCHIVE_H */

View File

@ -1,5 +1,4 @@
#ifndef __HASH_H
#define __HASH_H
#pragma once
#include "types.hh"
#include "serialise.hh"
@ -109,6 +108,3 @@ public:
}
#endif /* !__HASH_H */

View File

@ -1,5 +1,4 @@
#ifndef __IMMUTABLE_H
#define __IMMUTABLE_H
#pragma once
#include <types.hh>
@ -15,5 +14,3 @@ void makeImmutable(const Path & path);
void makeMutable(const Path & path);
}
#endif /* !__IMMUTABLE_H */

View File

@ -1,5 +1,4 @@
#ifndef __SERIALISE_H
#define __SERIALISE_H
#pragma once
#include "types.hh"
@ -130,6 +129,3 @@ MakeError(SerialisationError, Error)
}
#endif /* !__SERIALISE_H */

View File

@ -1,5 +1,4 @@
#ifndef __TYPES_H
#define __TYPES_H
#pragma once
#include <string>
#include <list>
@ -74,6 +73,3 @@ typedef enum {
}
#endif /* !__TYPES_H */

View File

@ -1,5 +1,4 @@
#ifndef __UTIL_H
#define __UTIL_H
#pragma once
#include "types.hh"
@ -333,6 +332,3 @@ void ignoreException();
}
#endif /* !__UTIL_H */

View File

@ -1,5 +1,4 @@
#ifndef __XML_WRITER_H
#define __XML_WRITER_H
#pragma once
#include <iostream>
#include <string>
@ -70,6 +69,3 @@ public:
}
#endif /* !__XML_WRITER_H */

View File

@ -1,5 +1,4 @@
#ifndef __PROFILES_H
#define __PROFILES_H
#pragma once
#include "types.hh"
#include "pathlocks.hh"
@ -54,6 +53,3 @@ void lockProfile(PathLocks & lock, const Path & profile);
string optimisticLockProfile(const Path & profile);
}
#endif /* !__PROFILES_H */

View File

@ -1,5 +1,4 @@
#ifndef __USER_ENV_H
#define __USER_ENV_H
#pragma once
#include "get-drvs.hh"
@ -12,9 +11,3 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
const string & lockToken);
}
#endif /* !__USER_ENV_H */

View File

@ -1,5 +1,4 @@
#ifndef __DOTGRAPH_H
#define __DOTGRAPH_H
#pragma once
#include "types.hh"
@ -8,5 +7,3 @@ namespace nix {
void printDotGraph(const PathSet & roots);
}
#endif /* !__DOTGRAPH_H */

View File

@ -1,5 +1,4 @@
#ifndef __XMLGRAPH_H
#define __XMLGRAPH_H
#pragma once
#include "types.hh"
@ -8,5 +7,3 @@ namespace nix {
void printXmlGraph(const PathSet & roots);
}
#endif /* !__XMLGRAPH_H */