Warn on implicit switch case fallthrough

This seems to have found one actual bug in fs-sink.cc: the symlink case
was falling into the regular file case, which can't possibly be
intentional, right?
This commit is contained in:
Jade Lovelace 2024-02-24 15:52:16 -08:00
parent 0b47783d0a
commit a82aeedb5b
3 changed files with 6 additions and 1 deletions

View file

@ -81,7 +81,7 @@ ifdef HOST_WINDOWS
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
endif
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
# Include the main lib, causing rules to be defined

View file

@ -94,6 +94,9 @@ static StringToken unescapeStr(SymbolTable & symbols, char * s, size_t length)
}
// yacc generates code that uses unannotated fallthrough.
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#define YY_USER_INIT initLoc(yylloc)
#define YY_USER_ACTION adjustLoc(yylloc, yytext, yyleng);

View file

@ -15,6 +15,7 @@ void copyRecursive(
case SourceAccessor::tSymlink:
{
sink.createSymlink(to, accessor.readLink(from));
break;
}
case SourceAccessor::tRegular:
@ -38,6 +39,7 @@ void copyRecursive(
sink, to + "/" + name);
break;
}
break;
}
case SourceAccessor::tMisc: