Bazel client: fix broken compilation Do not include <windows.h> in file_platform.h because it #defines many symbols that later code, particularly function definitions, conflict with, e.g. GetUserName, SendMessage. This was breaking the Bazel bootstrap project on CI. -- Change-Id: Ie4b59b00fc617bd3e7d0cbb967c1232798e055de Reviewed-on: https://cr.bazel.build/9127 PiperOrigin-RevId: 148986922 MOS_MIGRATED_REVID=148986922
diff --git a/src/main/cpp/blaze_util_windows.cc b/src/main/cpp/blaze_util_windows.cc index 839490b..a862fda 100644 --- a/src/main/cpp/blaze_util_windows.cc +++ b/src/main/cpp/blaze_util_windows.cc
@@ -1274,6 +1274,12 @@ #endif // COMPILER_MSVC } +#ifdef GetUserName +// By including <windows.h>, we have GetUserName defined either as +// GetUserNameA or GetUserNameW. +#undef GetUserName +#endif + string GetUserName() { WCHAR buffer[UNLEN + 1]; DWORD len = UNLEN + 1;