Skip to content

Commit afdffd8

Browse files
committed
Undefine 'near' and 'far' in mat4.h for host Windows
Previously, when a C++ file included 'windows.h' and subsequently included 'mat4.h', a compile error occurred. This is because, for some esoteric/obsolete reasons, 'windows.h' includes empty definitions of 'near' and 'far'. These conflict with the usage of 'near' and 'far' in 'mat4.h'. Add some logic to 'mat4.h' for host Windows that undefines 'near' and 'far' to avoid these conflicts. Test: Build libandroid_runtime on Windows Bug: 328307399 Change-Id: I13d068e7f800cf370a0f7d9f1b98479f9c6aeb35
1 parent 1a06751 commit afdffd8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

libs/math/include/math/mat4.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
#define CONSTEXPR
3535
#endif
3636

37+
#ifdef _WIN32
38+
// windows.h contains obsolete defines of 'near' and 'far' for systems using
39+
// legacy 16 bit pointers. Undefine them to avoid conflicting with the usage of
40+
// 'near' and 'far' in this file.
41+
#undef near
42+
#undef far
43+
#endif
44+
3745
namespace android {
3846
// -------------------------------------------------------------------------------------
3947
namespace details {

0 commit comments

Comments
 (0)