diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 3ecacfb..42cc9b1 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -103,6 +103,18 @@ #ifdef HAVE_CXX11_ATOMIC #include #elif defined(GLOG_OS_WINDOWS) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN // We only need minimal includes +# endif +// To avoid macro definition of ERROR. +# ifndef NOGDI +# define NOGDI +# endif +// To avoid macro definition of min/max. +# ifndef NOMINMAX +# define NOMINMAX +# endif + #include #endif @@ -1061,7 +1073,7 @@ namespace google { #elif defined(GLOG_OS_WINDOWS) #define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \ - static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \ + static volatile unsigned LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \ InterlockedIncrement(&LOG_OCCURRENCES); \ if (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) > n) \ InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n); \ @@ -1071,7 +1083,7 @@ namespace google { &what_to_do).stream() #define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \ - static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \ + static volatile unsigned LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \ InterlockedIncrement(&LOG_OCCURRENCES); \ if (condition && \ (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) || true) && \ @@ -1082,7 +1094,7 @@ namespace google { &what_to_do).stream() #define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \ - static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \ + static volatile unsigned LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \ InterlockedIncrement(&LOG_OCCURRENCES); \ if (InterlockedIncrement(&LOG_OCCURRENCES_MOD_N) > n) \ InterlockedExchangeSubtract(&LOG_OCCURRENCES_MOD_N, n); \ @@ -1092,7 +1104,7 @@ namespace google { &what_to_do).stream() #define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \ - static int LOG_OCCURRENCES = 0; \ + static volatile unsigned LOG_OCCURRENCES = 0; \ if (LOG_OCCURRENCES <= n) \ InterlockedIncrement(&LOG_OCCURRENCES); \ if (LOG_OCCURRENCES <= n) \