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
Change-Id: I63bba8ea809a12571ddc88cd1d20f2adeedf0b30
diff --git a/wifi/1.5/default/wifi.h b/wifi/1.5/default/wifi.h
index 840bdfd..c94ef3f 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 <functional>
+// 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 <android/hardware/wifi/1.5/IWifi.h>
#include <android-base/macros.h>
-#include <android/hardware/wifi/1.5/IWifi.h>
#include <utils/Looper.h>
+#include <functional>
#include "hidl_callback_util.h"
#include "wifi_chip.h"