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.cc
/src/libexpr/parser-tab.hh /src/libexpr/parser-tab.hh
/src/libexpr/parser-tab.output /src/libexpr/parser-tab.output
/src/libexpr/nixexpr-ast.hh
/src/libexpr/nixexpr-ast.cc
/src/libexpr/nix.tbl /src/libexpr/nix.tbl
# /src/libstore/ # /src/libstore/
/src/libstore/derivations-ast.cc
/src/libstore/derivations-ast.hh
/src/libstore/schema.sql.hh /src/libstore/schema.sql.hh
# /src/nix-env/ # /src/nix-env/

View file

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

View file

@ -1,9 +1,7 @@
#ifndef __COMMON_OPTS_H #pragma once
#define __COMMON_OPTS_H
#include "eval.hh" #include "eval.hh"
namespace nix { namespace nix {
/* Some common option parsing between nix-env and nix-instantiate. */ /* 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); Path lookupFileArg(EvalState & state, string s);
} }
#endif /* !__COMMON_OPTS_H */

View file

@ -1,5 +1,4 @@
#ifndef __EVAL_INLINE_H #pragma once
#define __EVAL_INLINE_H
#include "eval.hh" #include "eval.hh"
@ -8,7 +7,6 @@
namespace nix { namespace nix {
LocalNoInlineNoReturn(void throwEvalError(const char * s)) LocalNoInlineNoReturn(void throwEvalError(const char * s))
{ {
throw EvalError(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)); throwTypeError("value is %1% while a list was expected", showType(v));
} }
} }
#endif /* !__EVAL_INLINE_H */

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,4 @@
#ifndef __VALUE_H #pragma once
#define __VALUE_H
#include "symbol-table.hh" #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 #pragma once
#define __SHARED_H
#include "util.hh" #include "util.hh"
@ -54,6 +53,3 @@ extern int exitCode;
extern char * * argvSaved; extern char * * argvSaved;
} }
#endif /* !__SHARED_H */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,4 @@
#ifndef __STOREAPI_H #pragma once
#define __STOREAPI_H
#include "hash.hh" #include "hash.hh"
#include "serialise.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 #pragma once
#define __WORKER_PROTOCOL_H
namespace nix { 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 #pragma once
#define __ARCHIVE_H
#include "types.hh" #include "types.hh"
#include "serialise.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 #pragma once
#define __HASH_H
#include "types.hh" #include "types.hh"
#include "serialise.hh" #include "serialise.hh"
@ -109,6 +108,3 @@ public:
} }
#endif /* !__HASH_H */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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