From e1c6df329ce988bb03e9b0aa72cace3d679b9f9c Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sat, 3 Jul 2021 16:31:19 +0200 Subject: [PATCH] libsemanage: silence -Wextra-semi-stmt warning On Ubuntu 20.04, when building with clang -Werror -Wextra-semi-stmt (which is not the default build configuration), the compiler reports: genhomedircon.c:742:67: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt] const semanage_seuser_t **u2 = (const semanage_seuser_t **) arg2;; ^ Signed-off-by: Nicolas Iooss --- libsemanage/src/genhomedircon.c | 2 +- libsemanage/tests/libsemanage-tests.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c index d08c88de..7ca9afc3 100644 --- a/libsemanage/src/genhomedircon.c +++ b/libsemanage/src/genhomedircon.c @@ -740,7 +740,7 @@ static int write_user_context(genhomedircon_settings_t * s, FILE * out, static int seuser_sort_func(const void *arg1, const void *arg2) { const semanage_seuser_t **u1 = (const semanage_seuser_t **) arg1; - const semanage_seuser_t **u2 = (const semanage_seuser_t **) arg2;; + const semanage_seuser_t **u2 = (const semanage_seuser_t **) arg2; const char *name1 = semanage_seuser_get_name(*u1); const char *name2 = semanage_seuser_get_name(*u2); diff --git a/libsemanage/tests/libsemanage-tests.c b/libsemanage/tests/libsemanage-tests.c index 2ae4a21b..ee176703 100644 --- a/libsemanage/tests/libsemanage-tests.c +++ b/libsemanage/tests/libsemanage-tests.c @@ -41,13 +41,17 @@ #include #define DECLARE_SUITE(name) \ - suite = CU_add_suite(#name, name##_test_init, name##_test_cleanup); \ - if (NULL == suite) { \ - CU_cleanup_registry(); \ - return CU_get_error(); } \ - if (name##_add_tests(suite)) { \ - CU_cleanup_registry(); \ - return CU_get_error(); } + do { \ + suite = CU_add_suite(#name, name##_test_init, name##_test_cleanup); \ + if (NULL == suite) { \ + CU_cleanup_registry(); \ + return CU_get_error(); \ + } \ + if (name##_add_tests(suite)) { \ + CU_cleanup_registry(); \ + return CU_get_error(); \ + } \ + } while (0) static void usage(char *progname) {