From 9bd2d3f9374edc0dec11c08dd663a0879b370e20 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 6 Mar 2018 23:10:15 +0000 Subject: [PATCH] Problem: mis-detection of threadsafe_static_init causes test failures Solution: do not rely __cplusplus >= 201103L to detect whether the compiler supports thread safe static initialisation, but check only the proper feature preprocessor macro. GCC introduced it in version 8, and Clang in version 6. --- src/random.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/random.cpp b/src/random.cpp index 91f654ea..4e72870c 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -92,9 +92,8 @@ uint32_t zmq::generate_random () // configurable via config.h // TODO this should probably be done via config.h -#if __cplusplus >= 201103L \ - || (defined(__cpp_threadsafe_static_init) \ - && __cpp_threadsafe_static_init >= 200806) \ +#if (defined(__cpp_threadsafe_static_init) \ + && __cpp_threadsafe_static_init >= 200806) \ || (defined(_MSC_VER) && _MSC_VER >= 1900) #define ZMQ_HAVE_THREADSAFE_STATIC_LOCAL_INIT 1 // TODO this might probably also be set if a sufficiently recent gcc is used