From 2dd55590fd09ad506680b4888b4cf19f09d3eccc Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Wed, 18 Aug 2021 08:49:49 -0700 Subject: [PATCH] Undefine NAN after including it in Looper.h Looper.h needs to include the header for unordered_map, which itself includes math.h, which defines the macro NAN. Some HALs use enums called NAN, which causes a build error if the NAN macro is defined. We need to undef NAN in these cases after including Looper.h. Bug: 195020232 Test: presubmit: checkbuild Merged-In: I63bba8ea809a12571ddc88cd1d20f2adeedf0b30 Change-Id: I63bba8ea809a12571ddc88cd1d20f2adeedf0b30 (cherry picked from commit dda604440bd546c041106624c37dda4569420b9d) (cherry picked from commit 84a19f64f5fd2786a96b85fc5db88c1be82b6b0c) --- wifi/1.5/default/wifi.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wifi/1.5/default/wifi.h b/wifi/1.5/default/wifi.h index 840bdfd927..c94ef3f4cf 100644 --- a/wifi/1.5/default/wifi.h +++ b/wifi/1.5/default/wifi.h @@ -17,11 +17,15 @@ #ifndef WIFI_H_ #define WIFI_H_ -#include +// HACK: NAN is a macro defined in math.h, which can be included in various +// headers. This wifi HAL uses an enum called NAN, which does not compile when +// the macro is defined. Undefine NAN to work around it. +#undef NAN +#include #include -#include #include +#include #include "hidl_callback_util.h" #include "wifi_chip.h"