re-enable -Wunreachable-code under clang

whitelist the valid cases showing up

If an earlier version of clang is showing more cases (particularly
if they don't make sense), the re-enabling of the warning in
sys/unix/hints/include/compiler.2020 can be made clang-version
specific instead. I had no way to test earlier versions.
This commit is contained in:
nhmall
2021-10-22 12:27:10 -04:00
parent 0617410ff3
commit b44b5e35a8
8 changed files with 50 additions and 26 deletions

View File

@@ -923,7 +923,10 @@ set_savefile_name(boolean regularize_it)
overflow = 2;
}
#ifdef SAVE_EXTENSION
if (strlen(SAVE_EXTENSION) > 0 && !overflow) {
/* (0) is placed in brackets below so that the [&& !overflow] is
explicit dead code (the ">" comparison is detected as always
FALSE at compile-time). Done to appease clang's -Wunreachable-code */
if (strlen(SAVE_EXTENSION) > (0) && !overflow) {
if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1)) {
Strcat(g.SAVEF, SAVE_EXTENSION);
#ifdef MSDOS