From b6046e5e239e107a1c8c6a7f0c8283e47ae5a208 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 13 May 2023 00:18:37 +0200 Subject: [PATCH] Fix new warnings with GCC13 --- tests/test-mconcurrent.c | 2 +- tests/test-mtry.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test-mconcurrent.c b/tests/test-mconcurrent.c index e02d6d59..9188c6b9 100644 --- a/tests/test-mconcurrent.c +++ b/tests/test-mconcurrent.c @@ -201,7 +201,7 @@ static void test_rp_basic(void) { rpdict1_t dict; rpdict1_init(dict); - int z; + int z = 0; rpdict1_set_at(dict, 2, 3); rpdict1_get_copy(&z, dict, 2); assert (z == 3); diff --git a/tests/test-mtry.c b/tests/test-mtry.c index ec4eb815..3e389e92 100644 --- a/tests/test-mtry.c +++ b/tests/test-mtry.c @@ -399,9 +399,24 @@ static void test3(void) assert(flow ++ == 0); M_TRY(test1) { assert(flow ++ == 1); +#ifdef __GNUC__ +#if __GNUC__ >= 13 + /* Issue with GCC 13. It reports a variable as being not initialized + whereas it is obviously initialized. + See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109530 + */ + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +#endif +#endif M_DEFER( assert(flow++ == 3) ) { assert(flow ++ == 2); } +#ifdef __GNUC__ +#if __GNUC__ >= 13 + _Pragma("GCC diagnostic pop") +#endif +#endif } M_CATCH(test1, M_ERROR_MEMORY) { assert(0); }