From 96e6e680c1a298613756571e4984c340ce887c2a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 10 Nov 2019 11:14:26 -0500 Subject: [PATCH 1/3] Fix extra ; warnings involving MakeError --- src/libexpr/json-to-value.hh | 2 +- src/libexpr/nixexpr.hh | 16 ++++++++-------- src/libstore/build.cc | 2 +- src/libstore/store-api.hh | 12 ++++++------ src/libutil/serialise.hh | 2 +- src/libutil/thread-pool.hh | 2 +- src/libutil/types.hh | 4 ++-- src/libutil/util.hh | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libexpr/json-to-value.hh b/src/libexpr/json-to-value.hh index 33f35b16c..3b0fdae11 100644 --- a/src/libexpr/json-to-value.hh +++ b/src/libexpr/json-to-value.hh @@ -6,7 +6,7 @@ namespace nix { -MakeError(JSONParseError, EvalError) +MakeError(JSONParseError, EvalError); void parseJSON(EvalState & state, const string & s, Value & v); diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 665a42987..f7e9105a4 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -9,14 +9,14 @@ namespace nix { -MakeError(EvalError, Error) -MakeError(ParseError, Error) -MakeError(AssertionError, EvalError) -MakeError(ThrownError, AssertionError) -MakeError(Abort, EvalError) -MakeError(TypeError, EvalError) -MakeError(UndefinedVarError, Error) -MakeError(RestrictedPathError, Error) +MakeError(EvalError, Error); +MakeError(ParseError, Error); +MakeError(AssertionError, EvalError); +MakeError(ThrownError, AssertionError); +MakeError(Abort, EvalError); +MakeError(TypeError, EvalError); +MakeError(UndefinedVarError, Error); +MakeError(RestrictedPathError, Error); /* Position objects. */ diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 68c2f2ce3..a1b9c92f8 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1515,7 +1515,7 @@ void replaceValidPath(const Path & storePath, const Path tmpPath) } -MakeError(NotDeterministic, BuildError) +MakeError(NotDeterministic, BuildError); void DerivationGoal::buildDone() diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 250e1a4bc..b860b48be 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -20,12 +20,12 @@ namespace nix { -MakeError(SubstError, Error) -MakeError(BuildError, Error) /* denotes a permanent build failure */ -MakeError(InvalidPath, Error) -MakeError(Unsupported, Error) -MakeError(SubstituteGone, Error) -MakeError(SubstituterDisabled, Error) +MakeError(SubstError, Error); +MakeError(BuildError, Error) /* denotes a permanent build failure */; +MakeError(InvalidPath, Error); +MakeError(Unsupported, Error); +MakeError(SubstituteGone, Error); +MakeError(SubstituterDisabled, Error); struct BasicDerivation; diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index 0120aeecb..128e287f3 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -274,7 +274,7 @@ Sink & operator << (Sink & sink, const Strings & s); Sink & operator << (Sink & sink, const StringSet & s); -MakeError(SerialisationError, Error) +MakeError(SerialisationError, Error); template diff --git a/src/libutil/thread-pool.hh b/src/libutil/thread-pool.hh index bb16b639a..b22e0d162 100644 --- a/src/libutil/thread-pool.hh +++ b/src/libutil/thread-pool.hh @@ -11,7 +11,7 @@ namespace nix { -MakeError(ThreadPoolShutDown, Error) +MakeError(ThreadPoolShutDown, Error); /* A simple thread pool that executes a queue of work items (lambdas). */ diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 92bf469b5..4bc91828b 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -116,9 +116,9 @@ public: { \ public: \ using superClass::superClass; \ - }; + } -MakeError(Error, BaseError) +MakeError(Error, BaseError); class SysError : public Error { diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 3493e80b5..5f1d1d181 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -160,7 +160,7 @@ void readFull(int fd, unsigned char * buf, size_t count); void writeFull(int fd, const unsigned char * buf, size_t count, bool allowInterrupts = true); void writeFull(int fd, const string & s, bool allowInterrupts = true); -MakeError(EndOfFile, Error) +MakeError(EndOfFile, Error); /* Read a file descriptor until EOF occurs. */ @@ -333,10 +333,10 @@ void inline checkInterrupt() _interrupted(); } -MakeError(Interrupted, BaseError) +MakeError(Interrupted, BaseError); -MakeError(FormatError, Error) +MakeError(FormatError, Error); /* String tokenizer. */ From 4c34054673edd67cd1cfd81ab2972f27e518c78a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 10 Nov 2019 11:23:35 -0500 Subject: [PATCH 2/3] Remove unneeded semicolons --- src/libexpr/eval.cc | 2 +- src/libutil/args.hh | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index f60e8d3ab..34e527c52 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -432,7 +432,7 @@ Path EvalState::toRealPath(const Path & path, const PathSet & context) !context.empty() && store->isInStore(path) ? store->toRealPath(path) : path; -}; +} Value * EvalState::addConstant(const string & name, Value & v) diff --git a/src/libutil/args.hh b/src/libutil/args.hh index ad5fcca39..f8df39b5c 100644 --- a/src/libutil/args.hh +++ b/src/libutil/args.hh @@ -70,23 +70,23 @@ public: Args & args; Flag::ptr flag; friend class Args; - FlagMaker(Args & args) : args(args), flag(std::make_shared()) { }; + FlagMaker(Args & args) : args(args), flag(std::make_shared()) { } public: ~FlagMaker(); - FlagMaker & longName(const std::string & s) { flag->longName = s; return *this; }; - FlagMaker & shortName(char s) { flag->shortName = s; return *this; }; - FlagMaker & description(const std::string & s) { flag->description = s; return *this; }; - FlagMaker & label(const std::string & l) { flag->arity = 1; flag->labels = {l}; return *this; }; - FlagMaker & labels(const Strings & ls) { flag->arity = ls.size(); flag->labels = ls; return *this; }; - FlagMaker & arity(size_t arity) { flag->arity = arity; return *this; }; - FlagMaker & handler(std::function)> handler) { flag->handler = handler; return *this; }; - FlagMaker & handler(std::function handler) { flag->handler = [handler](std::vector) { handler(); }; return *this; }; + FlagMaker & longName(const std::string & s) { flag->longName = s; return *this; } + FlagMaker & shortName(char s) { flag->shortName = s; return *this; } + FlagMaker & description(const std::string & s) { flag->description = s; return *this; } + FlagMaker & label(const std::string & l) { flag->arity = 1; flag->labels = {l}; return *this; } + FlagMaker & labels(const Strings & ls) { flag->arity = ls.size(); flag->labels = ls; return *this; } + FlagMaker & arity(size_t arity) { flag->arity = arity; return *this; } + FlagMaker & handler(std::function)> handler) { flag->handler = handler; return *this; } + FlagMaker & handler(std::function handler) { flag->handler = [handler](std::vector) { handler(); }; return *this; } FlagMaker & handler(std::function handler) { flag->arity = 1; flag->handler = [handler](std::vector ss) { handler(std::move(ss[0])); }; return *this; - }; - FlagMaker & category(const std::string & s) { flag->category = s; return *this; }; + } + FlagMaker & category(const std::string & s) { flag->category = s; return *this; } template FlagMaker & dest(T * dest) @@ -94,7 +94,7 @@ public: flag->arity = 1; flag->handler = [=](std::vector ss) { *dest = ss[0]; }; return *this; - }; + } template FlagMaker & set(T * dest, const T & val) @@ -102,7 +102,7 @@ public: flag->arity = 0; flag->handler = [=](std::vector ss) { *dest = val; }; return *this; - }; + } FlagMaker & mkHashTypeFlag(HashType * ht); }; From 8669db1dcc9378bd61438e6c5978aea5d53d546f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 10 Nov 2019 16:21:59 -0500 Subject: [PATCH 3/3] Clean up semicolon and comma Thanks @bhipple for catching! --- src/libstore/store-api.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index b860b48be..1862fa267 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -21,7 +21,7 @@ namespace nix { MakeError(SubstError, Error); -MakeError(BuildError, Error) /* denotes a permanent build failure */; +MakeError(BuildError, Error); // denotes a permanent build failure MakeError(InvalidPath, Error); MakeError(Unsupported, Error); MakeError(SubstituteGone, Error);