aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/libexpr/lexer.l6
-rw-r--r--tests/unit/libstore-support/tests/path.cc2
3 files changed, 9 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 1d3d9df5d..313f02ede 100644
--- a/Makefile
+++ b/Makefile
@@ -68,4 +68,4 @@ endif
include mk/lib.mk
-GLOBAL_CXXFLAGS += -g -Wall -include $(buildprefix)config.h -std=c++2a -I src
+GLOBAL_CXXFLAGS += -g -Wall -Wimplicit-fallthrough -include $(buildprefix)config.h -std=c++2a -I src
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index df2cbd06f..ced1c4c39 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -20,6 +20,12 @@
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
#endif
+// yacc generates code that uses unannotated fallthrough.
+#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
+#endif
+
#include <boost/lexical_cast.hpp>
#include "nixexpr.hh"
diff --git a/tests/unit/libstore-support/tests/path.cc b/tests/unit/libstore-support/tests/path.cc
index e5f169e94..8bf501ab6 100644
--- a/tests/unit/libstore-support/tests/path.cc
+++ b/tests/unit/libstore-support/tests/path.cc
@@ -33,6 +33,7 @@ Gen<StorePathName> Arbitrary<StorePathName>::arbitrary()
switch (auto i = *gen::inRange<uint8_t>(0, 10 + 2 * 26 + 6)) {
case 0 ... 9:
pre += '0' + i;
+ break;
case 10 ... 35:
pre += 'A' + (i - 10);
break;
@@ -52,6 +53,7 @@ Gen<StorePathName> Arbitrary<StorePathName>::arbitrary()
pre += '.';
break;
}
+ [[fallthrough]];
case 65:
pre += '_';
break;