From 15afa8472e1b1bbf236d4cf8e9f399345c48d3fe Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 19 Jul 2020 21:52:35 +0100 Subject: fix(3p/nix): Fix all remaining compiler warnings This compiles under `-Wall -Werror`. The largest chunk of this change is `final` qualifiers for the various Nix CLI command structs, which inherit from a Command class that has more virtual functions than are implemented by each command. Change-Id: I0925e6e1a39013f026773db5816e4a77d50f3b4a Reviewed-on: https://cl.tvl.fyi/c/depot/+/1294 Tested-by: BuildkiteCI Reviewed-by: isomer Reviewed-by: kanepyork --- third_party/nix/src/libexpr/eval.cc | 1 - third_party/nix/src/libexpr/parser.hh | 11 +++++++++++ third_party/nix/src/libexpr/parser.y | 5 ++++- third_party/nix/src/libexpr/primops.cc | 2 -- 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'third_party/nix/src/libexpr') diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc index 704a05b197ba..5f267f2053fb 100644 --- a/third_party/nix/src/libexpr/eval.cc +++ b/third_party/nix/src/libexpr/eval.cc @@ -1252,7 +1252,6 @@ void EvalState::concatLists(Value& v, const NixList& lists, const Pos& pos) { auto outlist = new (GC) NixList(); - size_t len = 0; for (Value* list : lists) { forceList(*list, pos); outlist->insert(outlist->end(), list->list->begin(), list->list->end()); diff --git a/third_party/nix/src/libexpr/parser.hh b/third_party/nix/src/libexpr/parser.hh index 7592e3f82ce6..7b8f95573176 100644 --- a/third_party/nix/src/libexpr/parser.hh +++ b/third_party/nix/src/libexpr/parser.hh @@ -34,6 +34,15 @@ struct ParseData : public gc { sLetBody(symbols.Create("")){}; }; +// Clang fails to identify these functions as used, probably because +// of some interaction between the lexer/parser codegen and something +// else. +// +// To avoid warnings for that we disable -Wunused-function in this block. + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" + // TODO(tazjin): move dupAttr to anonymous namespace static void dupAttr(const AttrPath& attrPath, const Pos& pos, const Pos& prevPos) { @@ -85,4 +94,6 @@ static Expr* unescapeStr(SymbolTable& symbols, const char* s, size_t length) { return new ExprString(symbols.Create(t)); } +#pragma clang diagnostic pop // re-enable -Wunused-function + } // namespace nix diff --git a/third_party/nix/src/libexpr/parser.y b/third_party/nix/src/libexpr/parser.y index 56674ee7ede5..999872148895 100644 --- a/third_party/nix/src/libexpr/parser.y +++ b/third_party/nix/src/libexpr/parser.y @@ -11,7 +11,10 @@ %expect 1 %expect-rr 1 -%code requires { #include "libexpr/parser.hh" } +%code requires { +#define YY_NO_INPUT 1 // disable unused yyinput features +#include "libexpr/parser.hh" +} %{ diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc index fcd69144240a..107cacb963d9 100644 --- a/third_party/nix/src/libexpr/primops.cc +++ b/third_party/nix/src/libexpr/primops.cc @@ -1680,8 +1680,6 @@ static void prim_partition(EvalState& state, const Pos& pos, Value** args, state.forceFunction(*args[0], pos); state.forceList(*args[1], pos); - auto len = args[1]->listSize(); - NixList* right = new (GC) NixList(); NixList* wrong = new (GC) NixList(); -- cgit 1.4.1