eap: Silence warning

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;
      |                  ^~~~~~~~~
This commit is contained in:
Denis Kenzior 2023-10-06 23:24:25 -05:00
parent 073292315f
commit f86e7283e7
1 changed files with 3 additions and 3 deletions

View File

@ -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: