From: Bruno Haible Date: Wed, 28 Aug 2024 15:03:39 +0000 (+0200) Subject: threads-h: Don't override the C++ keyword 'thread_local'. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=103a72c07cbf1c912ae34eb856f0487252f975ea;p=gnulib.git threads-h: Don't override the C++ keyword 'thread_local'. * lib/threads.in.h (thread_local): Don't define as a macro in C++ 11 or newer. --- diff --git a/ChangeLog b/ChangeLog index ffeb7aa891..c17f003e31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-08-28 Bruno Haible + + threads-h: Don't override the C++ keyword 'thread_local'. + * lib/threads.in.h (thread_local): Don't define as a macro in C++ 11 + or newer. + 2024-08-27 Bruno Haible mcel: Fix compilation error with MSVC. diff --git a/lib/threads.in.h b/lib/threads.in.h index 06bc9b78df..b4f5b65c63 100644 --- a/lib/threads.in.h +++ b/lib/threads.in.h @@ -97,7 +97,9 @@ its expansion ends in a semicolon. */ # undef thread_local #endif -#if !@HAVE_THREADS_H@ || !defined thread_local +#if (!@HAVE_THREADS_H@ || !defined thread_local) \ + && !(defined __cplusplus \ + && (__cplusplus >= 201103L || (defined _MSC_VER && _MSC_VER >= 1900))) # define thread_local _Thread_local #endif /* Define the macro thread_local if and only if it actually works. */