commit cfd191a803a1577e70638b027bb2ec095985baf8
parent 43059d5022355cd060cf0ec2d63f59734aeb6c85
Author: Denis Kenzior <denkenz@gmail.com>
Date: Mon, 8 Nov 2021 15:11:55 -0600
eap: Silence uninitialized var warning
src/eap.c: In function 'eap_rx_packet':
src/eap.c:419:50: error: 'vendor_type' may be used uninitialized in this function [-Werror=maybe-uninitialized]
419 | (type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t))
| ^~
src/eap.c:430:11: note: 'vendor_type' was declared here
430 | uint32_t vendor_type;
It isn't clear why GCC complains about vendor_type, but not vendor_id.
But in all cases if type == EAP_TYPE_EXPANDED, then vendor_type and
vendor_id are set. Silence this spurious warning.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/eap.c b/src/eap.c
@@ -413,8 +413,11 @@ 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)))