diff options
| author | Joshua Watt <[email protected]> | 2018-02-09 10:27:18 -0600 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-02-10 03:19:26 +0100 |
| commit | 555e15ebe8bf1eb33d00747173cfc80cc65648a4 (patch) | |
| tree | 6aa9cca6e04514cbc45d88f96a873cc6a4767472 /tests | |
| parent | 240a068fcf3eb6bbcda525f80c8778de62621d9e (diff) | |
Use fallthrough attribute.
Use __attribute__ ((fallthrough)) to indicate switch case fall through
instead of a comment. This ensures that the fallthrough warning is not
triggered even if the file is pre-processed (hence stripping the
comments) before it is compiled.
The actual fallback implementation is hidden behind a FALLBACK macro in
case the compiler doesn't support it.
Finally, the -Wimplict-fallthrough warning was upgraded to only allow
the attribute to satisfy it; a comment alone is no longer sufficient.
Signed-off-by: Joshua Watt <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 4 | ||||
| -rw-r--r-- | tests/backtrace.c | 2 | ||||
| -rw-r--r-- | tests/elfstrmerge.c | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 89c531b4..5ee8626e 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2018-02-09 Joshua Watt <[email protected]> + + * elfstrmerge.c (main): Use FALLTHROUGH macro instead of comment. + 2018-01-22 Mark Wielaard <[email protected]> * allfcts.c (setup_alt): Print warning when alt file couldn't be diff --git a/tests/backtrace.c b/tests/backtrace.c index 21abe8af..f5dd761f 100644 --- a/tests/backtrace.c +++ b/tests/backtrace.c @@ -127,7 +127,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc, assert (symname2 == NULL || strcmp (symname2, "jmp") != 0); break; } - /* FALLTHRU */ + FALLTHROUGH; case 4: /* Some simple frame unwinders get this wrong and think sigusr2 is calling itself again. Allow it and just pretend there is diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c index 6924d0e9..3bb90c42 100644 --- a/tests/elfstrmerge.c +++ b/tests/elfstrmerge.c @@ -578,7 +578,8 @@ main (int argc, char **argv) break; case SHT_DYNAMIC: - /* Fallthrough. There are string indexes in here, but + FALLTHROUGH; + /* There are string indexes in here, but they (should) point to a allocated string table, which we don't alter. */ default: |
