forked from lix-project/lix
Merge pull request #10074 from lf-/jade/ban-implicit-fallthrough
Warn on implicit switch case fallthrough
(cherry picked from commit 21282c3c204597641402c6bcff8fc9ee7bc31fa1)
Change-Id: I5ebbdfb6c037d2c55254f37dd391c07c2ce7443e
This commit is contained in:
parent
0d9a043f43
commit
1342c8f18e
2
Makefile
2
Makefile
|
@ -68,4 +68,4 @@ endif
|
||||||
|
|
||||||
include mk/lib.mk
|
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
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
|
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
|
||||||
#endif
|
#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 <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#include "nixexpr.hh"
|
#include "nixexpr.hh"
|
||||||
|
|
|
@ -33,6 +33,7 @@ Gen<StorePathName> Arbitrary<StorePathName>::arbitrary()
|
||||||
switch (auto i = *gen::inRange<uint8_t>(0, 10 + 2 * 26 + 6)) {
|
switch (auto i = *gen::inRange<uint8_t>(0, 10 + 2 * 26 + 6)) {
|
||||||
case 0 ... 9:
|
case 0 ... 9:
|
||||||
pre += '0' + i;
|
pre += '0' + i;
|
||||||
|
break;
|
||||||
case 10 ... 35:
|
case 10 ... 35:
|
||||||
pre += 'A' + (i - 10);
|
pre += 'A' + (i - 10);
|
||||||
break;
|
break;
|
||||||
|
@ -52,6 +53,7 @@ Gen<StorePathName> Arbitrary<StorePathName>::arbitrary()
|
||||||
pre += '.';
|
pre += '.';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case 65:
|
case 65:
|
||||||
pre += '_';
|
pre += '_';
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue