From 8f6b6ac055a94ab7a274bae63cb3ffbf8a3939c0 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Sun, 20 Dec 2020 18:38:05 +0100 Subject: [PATCH] Don't pull in C++11+ for one class --- ConfigureChecks.cmake | 24 ++++++------------------ config.h.cmake | 1 - taglib/toolkit/trefcounter.cpp | 9 ++------- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 5e5fca2f..bcdbfe20 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -37,17 +37,6 @@ endif() # Determine which kind of atomic operations your compiler supports. check_cxx_source_compiles(" - #include - int main() { - std::atomic_int x(1); - ++x; - --x; - return 0; - } -" HAVE_STD_ATOMIC) - -if(NOT HAVE_STD_ATOMIC) - check_cxx_source_compiles(" int main() { volatile int x; __sync_add_and_fetch(&x, 1); @@ -56,8 +45,8 @@ if(NOT HAVE_STD_ATOMIC) } " HAVE_GCC_ATOMIC) - if(NOT HAVE_GCC_ATOMIC) - check_cxx_source_compiles(" +if(NOT HAVE_GCC_ATOMIC) + check_cxx_source_compiles(" #include int main() { volatile int32_t x; @@ -67,8 +56,8 @@ if(NOT HAVE_STD_ATOMIC) } " HAVE_MAC_ATOMIC) - if(NOT HAVE_MAC_ATOMIC) - check_cxx_source_compiles(" + if(NOT HAVE_MAC_ATOMIC) + check_cxx_source_compiles(" #include int main() { volatile LONG x; @@ -78,8 +67,8 @@ if(NOT HAVE_STD_ATOMIC) } " HAVE_WIN_ATOMIC) - if(NOT HAVE_WIN_ATOMIC) - check_cxx_source_compiles(" + if(NOT HAVE_WIN_ATOMIC) + check_cxx_source_compiles(" #include int main() { volatile int x; @@ -88,7 +77,6 @@ if(NOT HAVE_STD_ATOMIC) return 0; } " HAVE_IA64_ATOMIC) - endif() endif() endif() endif() diff --git a/config.h.cmake b/config.h.cmake index c1a31094..8d8c36ab 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -11,7 +11,6 @@ #cmakedefine HAVE_OPENBSD_BYTESWAP 1 /* Defined if your compiler supports some atomic operations */ -#cmakedefine HAVE_STD_ATOMIC 1 #cmakedefine HAVE_GCC_ATOMIC 1 #cmakedefine HAVE_MAC_ATOMIC 1 #cmakedefine HAVE_WIN_ATOMIC 1 diff --git a/taglib/toolkit/trefcounter.cpp b/taglib/toolkit/trefcounter.cpp index 6638fcaa..18cb596c 100644 --- a/taglib/toolkit/trefcounter.cpp +++ b/taglib/toolkit/trefcounter.cpp @@ -29,12 +29,7 @@ #include "trefcounter.h" -#if defined(HAVE_STD_ATOMIC) -# include -# define ATOMIC_INT std::atomic_int -# define ATOMIC_INC(x) (++x) -# define ATOMIC_DEC(x) (--x) -#elif defined(HAVE_GCC_ATOMIC) +#if defined(HAVE_GCC_ATOMIC) # define ATOMIC_INT int # define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1) # define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1) @@ -57,7 +52,7 @@ # define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1) # define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1) #else -# define ATOMIC_INT int +# define ATOMIC_INT volatile int # define ATOMIC_INC(x) (++x) # define ATOMIC_DEC(x) (--x) #endif