From 0b3a5a0b00bf3f677d570281c0fcf06a54bdeca3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 14 Feb 2017 14:51:39 +0000 Subject: [PATCH] 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 d3912f305..33086b2fd 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 04b3bddf3..1bec9a57b 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 73da722ff..4af394387 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 1551a1a74..68818358b 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 54875fa46..5aa663c14 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,