[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v2 1/2] GCC 7: Add __attribute__((noreturn)) to some usage functions which call exit.



This happens with GCC 7.0.1.  The errors were all of the form:

qemu-speed-test.c: In function 'main':
qemu-speed-test.c:153:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
       usage (EXIT_SUCCESS);
       ^~~~~~~~~~~~~~~~~~~~
qemu-speed-test.c:155:5: note: here
     default:
     ^~~~~~~
---
 builder/index-validate.c                | 2 +-
 utils/boot-analysis/boot-analysis.c     | 2 +-
 utils/boot-benchmark/boot-benchmark.c   | 2 +-
 utils/qemu-boot/qemu-boot.c             | 2 +-
 utils/qemu-speed-test/qemu-speed-test.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/builder/index-validate.c b/builder/index-validate.c
index d3912f3..33086b2 100644
--- a/builder/index-validate.c
+++ b/builder/index-validate.c
@@ -38,7 +38,7 @@
 
 extern int do_parse (struct parse_context *context, FILE *in);
 
-static void
+static void __attribute__((noreturn))
 usage (int exit_status)
 {
   printf ("%s index\n", getprogname ());
diff --git a/utils/boot-analysis/boot-analysis.c b/utils/boot-analysis/boot-analysis.c
index 04b3bdd..1bec9a5 100644
--- a/utils/boot-analysis/boot-analysis.c
+++ b/utils/boot-analysis/boot-analysis.c
@@ -88,7 +88,7 @@ static void print_longest_to_shortest (void);
 static void free_pass_data (void);
 static void free_final_timeline (void);
 
-static void
+static void __attribute__((noreturn))
 usage (int exitcode)
 {
   guestfs_h *g;
diff --git a/utils/boot-benchmark/boot-benchmark.c b/utils/boot-benchmark/boot-benchmark.c
index 73da722..4af3943 100644
--- a/utils/boot-benchmark/boot-benchmark.c
+++ b/utils/boot-benchmark/boot-benchmark.c
@@ -51,7 +51,7 @@ static void run_test (void);
 static guestfs_h *create_handle (void);
 static void add_drive (guestfs_h *g);
 
-static void
+static void __attribute__((noreturn))
 usage (int exitcode)
 {
   guestfs_h *g;
diff --git a/utils/qemu-boot/qemu-boot.c b/utils/qemu-boot/qemu-boot.c
index 1551a1a..6881835 100644
--- a/utils/qemu-boot/qemu-boot.c
+++ b/utils/qemu-boot/qemu-boot.c
@@ -74,7 +74,7 @@ static void run_test (size_t P);
 static void *start_thread (void *thread_data_vp);
 static void message_callback (guestfs_h *g, void *opaque, uint64_t event, int event_handle, int flags, const char *buf, size_t buf_len, const uint64_t *array, size_t array_len);
 
-static void
+static void __attribute__((noreturn))
 usage (int exitcode)
 {
   fprintf (stderr,
diff --git a/utils/qemu-speed-test/qemu-speed-test.c b/utils/qemu-speed-test/qemu-speed-test.c
index 54875fa..5aa663c 100644
--- a/utils/qemu-speed-test/qemu-speed-test.c
+++ b/utils/qemu-speed-test/qemu-speed-test.c
@@ -66,7 +66,7 @@ reset_default_tests (int *flag)
   }
 }
 
-static void
+static void __attribute__((noreturn))
 usage (int exitcode)
 {
   fprintf (stderr,
-- 
2.10.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]