Merge "<threads.h>: `thread_local` should match the C23 #if guard for `static_assert`." into main am: 3932e93edd
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3254859
Change-Id: Ifccfbaa958691c9ec6daa16bb78d29eda64ad100
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libc/include/threads.h b/libc/include/threads.h
index b1008de..1074fa4 100644
--- a/libc/include/threads.h
+++ b/libc/include/threads.h
@@ -72,8 +72,10 @@
thrd_timedout = 4,
};
-#if !defined(__cplusplus)
-#define thread_local _Thread_local
+/* `thread_local` is a keyword in C++11 and C23; C11 had `_Thread_local` instead. */
+#if !defined(__cplusplus) && (__STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L)
+# undef thread_local
+# define thread_local _Thread_local
#endif
__BEGIN_DECLS