From ed5154d7fe697c46a9ab38a9e2a3cd299d0119ff Mon Sep 17 00:00:00 2001 From: mehrdadn Date: Mon, 25 Nov 2019 16:02:26 -0800 Subject: [PATCH] Modify RayLogLevel to avoid conflicts with DEBUG macro and ERROR macros that are defined externally (#6204) * Prevent name collision of ERROR macro from Windows with RayLogLevel::ERROR --- src/ray/util/logging.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ray/util/logging.h b/src/ray/util/logging.h index d61598260..da5cd5f25 100644 --- a/src/ray/util/logging.h +++ b/src/ray/util/logging.h @@ -4,6 +4,21 @@ #include #include +#if defined(_WIN32) +#ifndef _WINDOWS_ +#ifndef WIN32_LEAN_AND_MEAN // Sorry for the inconvenience. Please include any related + // headers you need manually. + // (https://stackoverflow.com/a/8294669) +#define WIN32_LEAN_AND_MEAN // Prevent inclusion of WinSock2.h +#endif +#include // Force inclusion of WinGDI here to resolve name conflict +#endif +#ifdef ERROR // Should be true unless someone else undef'd it already +#undef ERROR // Windows GDI defines this macro; make it a global enum so it doesn't + // conflict with our code +enum { ERROR = 0 }; +#endif +#endif namespace ray { enum class RayLogLevel { DEBUG = -1, INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3 };