Skip to content

Commit

Permalink
fallthrough: silence warnings
Browse files Browse the repository at this point in the history
In some switch statements, we want to combine case statements. However,
compilers and code analysis tools warn about these cases. To silence them
and acknowledge the behavior as expected, label the intentional cases.

Signed-off-by: Norbert Manthey <[email protected]>
  • Loading branch information
nmanthey authored and wipawel committed Aug 21, 2020
1 parent d81aa6f commit 9bb341f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ reswitch: switch (ch = (unsigned char)*fmt++) {
goto handle_nosign;
case 'X':
upper = 1;
#if defined(__GNUC__) && !defined(__clang__)
__attribute__ ((fallthrough));
#endif
case 'x':
base = 16;
goto handle_nosign;
Expand Down

0 comments on commit 9bb341f

Please sign in to comment.