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

@@ -530,11 +530,14 @@ coord_desc(int x, int y, char *outbuf, char cmode)
/* for normal map sizes, force a fixed-width formatting so that
/m, /M, /o, and /O output lines up cleanly; map sizes bigger
than Nx999 or 999xM will still work, but not line up like normal
when displayed in a column setting */
when displayed in a column setting.
The (100) is placed in brackets below to mark the [: "03"] as
explicit compile-time dead code for clang */
if (!*screen_fmt)
Sprintf(screen_fmt, "[%%%sd,%%%sd]",
(ROWNO - 1 + 2 < 100) ? "02" : "03",
(COLNO - 1 < 100) ? "02" : "03");
(ROWNO - 1 + 2 < (100)) ? "02" : "03",
(COLNO - 1 < (100)) ? "02" : "03");
/* map line 0 is screen row 2;
map column 0 isn't used, map column 1 is screen column 1 */
Sprintf(outbuf, screen_fmt, y + 2, x);