59 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
		
		
			
		
	
	
			59 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
|   | diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
 | ||
|  | index 3ecacfb..ef10284 100644
 | ||
|  | --- a/src/glog/logging.h.in
 | ||
|  | +++ b/src/glog/logging.h.in
 | ||
|  | @@ -100,7 +100,7 @@
 | ||
|  |  #include <gflags/gflags.h> | ||
|  |  #endif | ||
|  |   | ||
|  | -#ifdef HAVE_CXX11_ATOMIC
 | ||
|  | +#if @ac_cv_cxx11_atomic@
 | ||
|  |  #include <atomic> | ||
|  |  #elif defined(GLOG_OS_WINDOWS) | ||
|  |  #include <Windows.h> | ||
|  | @@ -1014,7 +1014,7 @@ extern "C" void AnnotateBenignRaceSized(
 | ||
|  |  namespace google { | ||
|  |  #endif | ||
|  |   | ||
|  | -#ifdef HAVE_CXX11_ATOMIC
 | ||
|  | +#if @ac_cv_cxx11_atomic@
 | ||
|  |  #define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \ | ||
|  |    static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \ | ||
|  |    _GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \ | ||
|  | @@ -1061,7 +1061,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 +1071,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 +1082,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 +1092,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) \ |