From f86e7283e79f6b98a91aab16e6defad86e6da2eb Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 6 Oct 2023 23:24:25 -0500 Subject: [PATCH] eap: Silence warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous attempt at working around this warning seems to no longer work with gcc 13 In function ‘eap_handle_response’, inlined from ‘eap_rx_packet’ at src/eap.c:570:3: src/eap.c:421:49: error: ‘vendor_id’ may be used uninitialized [-Werror=maybe-uninitialized] 421 | (type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t)) | ~~~~~~~~~~^~~~~~~ src/eap.c:533:20: note: in expansion of macro ‘IS_EXPANDED_RESPONSE’ 533 | } else if (IS_EXPANDED_RESPONSE(our_vendor_id, our_vendor_type)) | ^~~~~~~~~~~~~~~~~~~~ src/eap.c: In function ‘eap_rx_packet’: src/eap.c:431:18: note: ‘vendor_id’ was declared here 431 | uint32_t vendor_id; | ^~~~~~~~~ --- src/eap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eap.c b/src/eap.c index 981b6388..4d08f072 100644 --- a/src/eap.c +++ b/src/eap.c @@ -415,11 +415,8 @@ static const char *eap_type_to_str(enum eap_type type, uint32_t vendor_id, return buf; } -_Pragma("GCC diagnostic push") -_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") #define IS_EXPANDED_RESPONSE(id, t) \ (type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t)) -_Pragma("GCC diagnostic pop") #define RESPONSE_IS(t) \ (type == (t) || IS_EXPANDED_RESPONSE(0, (t))) @@ -530,7 +527,10 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt, if (our_type != EAP_TYPE_EXPANDED) { if (RESPONSE_IS(our_type)) goto handle_response; +_Pragma("GCC diagnostic push") +_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") } else if (IS_EXPANDED_RESPONSE(our_vendor_id, our_vendor_type)) +_Pragma("GCC diagnostic pop") goto handle_response; error: