[PATCH] tests: Add break to avoid implicit-fallthrough warning

Mark Wielaard mark@klomp.org
Fri Dec 6 14:42:00 GMT 2019


For some reason gcc might fail to recognize the assert (0) will never
return and emit an implicit-fallthrough warning. Just add a break to
silence it.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog        | 4 ++++
 tests/backtrace-data.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 70100de4..fb881e76 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2019-12-06  Mark Wielaard  <mark@klomp.org>
+
+	* backtrace-data.c (main): Add break after assert.
+
 2019-12-05  Mark Wielaard  <mark@klomp.org>
 
 	* run-elfclassify.sh: Run elfcompress under testrun.
diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
index 907b4780..c81880d9 100644
--- a/tests/backtrace-data.c
+++ b/tests/backtrace-data.c
@@ -280,6 +280,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
   {
     case -1:
       assert (0);
+      break;
     case 0:;
       long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
       assert (l == 0);
-- 
2.20.1



More information about the Elfutils-devel mailing list