[Cmake-commits] CMake branch, next, updated. v3.1.0-1461-g1fac291
Stephen Kelly
steveire at gmail.com
Thu Jan 1 12:48:40 EST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 1fac2911e1008224c9c0f0676e0e2b90d0cc25d4 (commit)
via 998e9c10943ef361785e6f15cab1fa61172b1c24 (commit)
via ec31926d24ac2cf9a8aef4cfbcbeaaca0c99b717 (commit)
from 03a66cff114687d0d9e71a289b05a66259853d47 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fac2911e1008224c9c0f0676e0e2b90d0cc25d4
commit 1fac2911e1008224c9c0f0676e0e2b90d0cc25d4
Merge: 03a66cf 998e9c1
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jan 1 12:48:39 2015 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 1 12:48:39 2015 -0500
Merge topic 'WCDH-thread_local-portability' into next
998e9c10 WCDH: Add feature portability for thread_local.
ec31926d CMake Nightly Date Stamp
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=998e9c10943ef361785e6f15cab1fa61172b1c24
commit 998e9c10943ef361785e6f15cab1fa61172b1c24
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jan 1 17:56:01 2015 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Jan 1 18:20:10 2015 +0100
WCDH: Add feature portability for thread_local.
AppleClang does not support the cxx_thread_local feature, even
though it is based on a Clang version which does support the
feature.
http://stackoverflow.com/a/23850891/2428389
A possible reason for that is that thread_local might be used as
a variable in existing Apple SDK headers.
Extend the WriteCompilerDetectionHeader module to generate a define
for that feature with portability fallbacks. For the avoidance of
making it easy to write code which looks correct but which has odd
runtime behavior, don't set the define symbol at all if no
equivalent keyword is known.
diff --git a/Help/release/dev/WCDH-thread_local.rst b/Help/release/dev/WCDH-thread_local.rst
new file mode 100644
index 0000000..44516a7
--- /dev/null
+++ b/Help/release/dev/WCDH-thread_local.rst
@@ -0,0 +1,7 @@
+WriteCompilerDetectionHeader thread_local portability
+-----------------------------------------------------
+
+* The :module:`WriteCompilerDetectionHeader` module learned to
+ create a define for portability of the cxx_thread_local feature. The define
+ expands to either the C++11 ``thread_local`` keyword, or a
+ pre-standardization compiler-specific equivalent, as appropriate.
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 36b9706..d61358f 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -194,6 +194,7 @@
# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert``
# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]``
# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]``
+# ``cxx_thread_local`` ``<PREFIX>_THREAD_LOCAL`` ``thread_local``
# ============================= ================================ =====================
#
# A use-case which arises with such deprecation macros is the deprecation
@@ -573,6 +574,20 @@ function(write_compiler_detection_header
# endif
\n")
endif()
+ if (feature STREQUAL cxx_thread_local)
+ set(def_value "${prefix_arg}_THREAD_LOCAL")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} thread_local
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
+# define ${def_value} __thread
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __declspec(thread)
+# else
+// ${def_value} not defined for this configuration.
+# endif
+\n")
+ endif()
if (feature STREQUAL cxx_attribute_deprecated)
set(def_name ${prefix_arg}_${feature_PP})
set(def_value "${prefix_arg}_DEPRECATED")
-----------------------------------------------------------------------
Summary of changes:
Help/release/dev/WCDH-thread_local.rst | 7 +++++++
Modules/WriteCompilerDetectionHeader.cmake | 15 +++++++++++++++
Source/CMakeVersion.cmake | 2 +-
3 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 Help/release/dev/WCDH-thread_local.rst
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list