Skip to content

Commit

Permalink
Merge pull request #10074 from lf-/jade/ban-implicit-fallthrough
Browse files Browse the repository at this point in the history
Warn on implicit switch case fallthrough
  • Loading branch information
thufschmitt authored Feb 26, 2024
2 parents 7d9ae5f + a82aeed commit 21282c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/libexpr/lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/libutil/fs-sink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void copyRecursive(
case SourceAccessor::tSymlink:
{
sink.createSymlink(to, accessor.readLink(from));
break;
}

case SourceAccessor::tRegular:
Expand All @@ -38,6 +39,7 @@ void copyRecursive(
sink, to + "/" + name);
break;
}
break;
}

case SourceAccessor::tMisc:
Expand Down

0 comments on commit 21282c3

Please sign in to comment.