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
This commit is contained in:
Prabir Pradhan
2021-08-18 08:49:49 -07:00
parent 38fe3c5962
commit b99a3ccddf

View File

@@ -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.4/IWifi.h>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.4/IWifi.h>
#include <utils/Looper.h>
#include <functional>
#include "hidl_callback_util.h"
#include "wifi_chip.h"