com php-src: Fix C++ compatibility for TSRM_TLS: TSRM/TSR M.h

From: Date: Wed, 15 Nov 2017 11:44:04 +0000
Subject: com php-src: Fix C++ compatibility for TSRM_TLS: TSRM/TSR M.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100257@lists.php.net to get a copy of this message
Commit: 0e5d4ea55554872fe72e5d984b73fc21abc561fe Author: Anatol Belski <ab@php.net> Wed, 15 Nov 2017 12:33:35 +0100 Parents: 5b28218cc6114e4bc0e92290cbad7a88ee7c9ddb Branches: PHP-7.2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0e5d4ea55554872fe72e5d984b73fc21abc561fe Log: Fix C++ compatibility for TSRM_TLS If a C++11 source is compiled, thread_local is preferred. Furthermore, at least GCC treats __thread vs. thread_local a different way and under certain circumstances would refuse to compile __thread is a C++11 source.. This change is far behind in time, any up-to-date compiler supports C++11 and otherwise it won't take effect on lower versions. Changed paths: M TSRM/TSRM.h Diff: diff --git a/TSRM/TSRM.h b/TSRM/TSRM..h index 39d4bcc..4ecee63 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -157,10 +157,14 @@ TSRM_API void tsrm_free_interpreter_context(void *context); TSRM_API void *tsrm_get_ls_cache(void); TSRM_API uint8_t tsrm_is_main_thread(void); -#ifdef TSRM_WIN32 -# define TSRM_TLS __declspec(thread) +#if defined(__cplusplus) && __cplusplus > 199711L +# define TSRM_TLS thread_local #else -# define TSRM_TLS __thread +# ifdef TSRM_WIN32 +# define TSRM_TLS __declspec(thread) +# else +# define TSRM_TLS __thread +# endif #endif #define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)

« previous php.cvs (#100257) next »