From b7fd2c28224a69476434d69b5d9da3d150c07226 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Jul 2012 14:59:03 -0400 Subject: Use "#pragma once" to prevent repeated header file inclusion --- .gitignore | 4 ---- src/libexpr/attr-path.hh | 9 +-------- src/libexpr/common-opts.hh | 7 +------ src/libexpr/eval-inline.hh | 7 +------ src/libexpr/eval.hh | 6 +----- src/libexpr/get-drvs.hh | 6 +----- src/libexpr/names.hh | 11 +---------- src/libexpr/nixexpr.hh | 6 +----- src/libexpr/symbol-table.hh | 5 +---- src/libexpr/value-to-xml.hh | 5 +---- src/libexpr/value.hh | 5 +---- src/libmain/shared.hh | 6 +----- src/libstore/derivations.hh | 6 +----- src/libstore/globals.hh | 6 +----- src/libstore/local-store.hh | 6 +----- src/libstore/misc.hh | 6 +----- src/libstore/pathlocks.hh | 6 +----- src/libstore/references.hh | 5 +---- src/libstore/remote-store.hh | 6 +----- src/libstore/store-api.hh | 6 +----- src/libstore/worker-protocol.hh | 7 +------ src/libutil/archive.hh | 6 +----- src/libutil/hash.hh | 6 +----- src/libutil/immutable.hh | 5 +---- src/libutil/serialise.hh | 6 +----- src/libutil/types.hh | 6 +----- src/libutil/util.hh | 6 +----- src/libutil/xml-writer.hh | 6 +----- src/nix-env/profiles.hh | 6 +----- src/nix-env/user-env.hh | 9 +-------- src/nix-store/dotgraph.hh | 5 +---- src/nix-store/xmlgraph.hh | 5 +---- 32 files changed, 31 insertions(+), 166 deletions(-) diff --git a/.gitignore b/.gitignore index d7f151507f..3fb96f1249 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/src/libexpr/attr-path.hh b/src/libexpr/attr-path.hh index b106da5ef8..d3aad74611 100644 --- a/src/libexpr/attr-path.hh +++ b/src/libexpr/attr-path.hh @@ -1,20 +1,13 @@ -#ifndef __ATTR_PATH_H -#define __ATTR_PATH_H +#pragma once #include "eval.hh" #include #include - namespace nix { - void findAlongAttrPath(EvalState & state, const string & attrPath, Bindings & autoArgs, Expr * e, Value & v); - } - - -#endif /* !__ATTR_PATH_H */ diff --git a/src/libexpr/common-opts.hh b/src/libexpr/common-opts.hh index c28641e901..e2e3fe7717 100644 --- a/src/libexpr/common-opts.hh +++ b/src/libexpr/common-opts.hh @@ -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 */ diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh index 6026a7d110..57a9e4c63c 100644 --- a/src/libexpr/eval-inline.hh +++ b/src/libexpr/eval-inline.hh @@ -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 */ diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index bab9303b08..5103ae8cef 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -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 */ diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh index 2d260c57be..879dc8dbb4 100644 --- a/src/libexpr/get-drvs.hh +++ b/src/libexpr/get-drvs.hh @@ -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 */ diff --git a/src/libexpr/names.hh b/src/libexpr/names.hh index e189302d6d..ebe113e82a 100644 --- a/src/libexpr/names.hh +++ b/src/libexpr/names.hh @@ -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 DrvNames; - int compareVersions(const string & v1, const string & v2); DrvNames drvNamesFromArgs(const Strings & opArgs); - } - - -#endif /* !__NAMES_H */ diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 6eb771a726..4c1a0bb2d5 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -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 */ diff --git a/src/libexpr/symbol-table.hh b/src/libexpr/symbol-table.hh index 976117a20a..143fc495b0 100644 --- a/src/libexpr/symbol-table.hh +++ b/src/libexpr/symbol-table.hh @@ -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 */ diff --git a/src/libexpr/value-to-xml.hh b/src/libexpr/value-to-xml.hh index 3ebc989ffa..97657327ed 100644 --- a/src/libexpr/value-to-xml.hh +++ b/src/libexpr/value-to-xml.hh @@ -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 */ diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh index 41512d40b1..c9ec236c47 100644 --- a/src/libexpr/value.hh +++ b/src/libexpr/value.hh @@ -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 */ diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh index d198df70d1..7849e10e36 100644 --- a/src/libmain/shared.hh +++ b/src/libmain/shared.hh @@ -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 */ diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index 27e471d885..8f22b4afa6 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -1,5 +1,4 @@ -#ifndef __DERIVATIONS_H -#define __DERIVATIONS_H +#pragma once #include @@ -81,6 +80,3 @@ typedef std::map DrvHashes; extern DrvHashes drvHashes; } - - -#endif /* !__DERIVATIONS_H */ diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 12a9b9ca15..1c0877a5e1 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -1,5 +1,4 @@ -#ifndef __GLOBALS_H -#define __GLOBALS_H +#pragma once #include "types.hh" @@ -118,6 +117,3 @@ void setDefaultsFromEnvironment(); } - - -#endif /* !__GLOBALS_H */ diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 65ee029c26..eb7705219a 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -1,5 +1,4 @@ -#ifndef __LOCAL_STORE_H -#define __LOCAL_STORE_H +#pragma once #include @@ -302,6 +301,3 @@ void deletePathWrapped(const Path & path, void deletePathWrapped(const Path & path); } - - -#endif /* !__LOCAL_STORE_H */ diff --git a/src/libstore/misc.hh b/src/libstore/misc.hh index 850c12af4e..fe0bbdd799 100644 --- a/src/libstore/misc.hh +++ b/src/libstore/misc.hh @@ -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 */ diff --git a/src/libstore/pathlocks.hh b/src/libstore/pathlocks.hh index 57ca1584a6..8a6b1450da 100644 --- a/src/libstore/pathlocks.hh +++ b/src/libstore/pathlocks.hh @@ -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 */ diff --git a/src/libstore/references.hh b/src/libstore/references.hh index 158c08a776..013809d122 100644 --- a/src/libstore/references.hh +++ b/src/libstore/references.hh @@ -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 */ diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index f0e5dbf769..c57b49ce15 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -1,5 +1,4 @@ -#ifndef __REMOTE_STORE_H -#define __REMOTE_STORE_H +#pragma once #include @@ -101,6 +100,3 @@ private: } - - -#endif /* !__REMOTE_STORE_H */ diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 0ab15c3806..9ba67852ef 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -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 */ diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index b08410fa1c..501c0b3db5 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -1,6 +1,4 @@ -#ifndef __WORKER_PROTOCOL_H -#define __WORKER_PROTOCOL_H - +#pragma once namespace nix { @@ -64,6 +62,3 @@ template T readStorePaths(Source & from); } - - -#endif /* !__WORKER_PROTOCOL_H */ diff --git a/src/libutil/archive.hh b/src/libutil/archive.hh index fff6203139..ccac92074d 100644 --- a/src/libutil/archive.hh +++ b/src/libutil/archive.hh @@ -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 */ diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh index e0b6478cc4..781f517428 100644 --- a/src/libutil/hash.hh +++ b/src/libutil/hash.hh @@ -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 */ diff --git a/src/libutil/immutable.hh b/src/libutil/immutable.hh index 5a42a46107..8af4190049 100644 --- a/src/libutil/immutable.hh +++ b/src/libutil/immutable.hh @@ -1,5 +1,4 @@ -#ifndef __IMMUTABLE_H -#define __IMMUTABLE_H +#pragma once #include @@ -15,5 +14,3 @@ void makeImmutable(const Path & path); void makeMutable(const Path & path); } - -#endif /* !__IMMUTABLE_H */ diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index ded4b12a04..42dd271176 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -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 */ diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 844ad6f76a..165a46fa28 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -1,5 +1,4 @@ -#ifndef __TYPES_H -#define __TYPES_H +#pragma once #include #include @@ -74,6 +73,3 @@ typedef enum { } - - -#endif /* !__TYPES_H */ diff --git a/src/libutil/util.hh b/src/libutil/util.hh index ee0f3862a8..362d0f65e2 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -1,5 +1,4 @@ -#ifndef __UTIL_H -#define __UTIL_H +#pragma once #include "types.hh" @@ -333,6 +332,3 @@ void ignoreException(); } - - -#endif /* !__UTIL_H */ diff --git a/src/libutil/xml-writer.hh b/src/libutil/xml-writer.hh index e5cc5f8c54..fee2eb495e 100644 --- a/src/libutil/xml-writer.hh +++ b/src/libutil/xml-writer.hh @@ -1,5 +1,4 @@ -#ifndef __XML_WRITER_H -#define __XML_WRITER_H +#pragma once #include #include @@ -70,6 +69,3 @@ public: } - - -#endif /* !__XML_WRITER_H */ diff --git a/src/nix-env/profiles.hh b/src/nix-env/profiles.hh index a64258dae2..30d2376d99 100644 --- a/src/nix-env/profiles.hh +++ b/src/nix-env/profiles.hh @@ -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 */ diff --git a/src/nix-env/user-env.hh b/src/nix-env/user-env.hh index 4125d82173..f188efe9b4 100644 --- a/src/nix-env/user-env.hh +++ b/src/nix-env/user-env.hh @@ -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 */ - - - - diff --git a/src/nix-store/dotgraph.hh b/src/nix-store/dotgraph.hh index 2318e2fde4..68410d8415 100644 --- a/src/nix-store/dotgraph.hh +++ b/src/nix-store/dotgraph.hh @@ -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 */ diff --git a/src/nix-store/xmlgraph.hh b/src/nix-store/xmlgraph.hh index 2f9908c436..c2216c5a46 100644 --- a/src/nix-store/xmlgraph.hh +++ b/src/nix-store/xmlgraph.hh @@ -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 */ -- cgit 1.4.1