Selaa lähdekoodia

Features: Add cxx_nullptr.

Stephen Kelly 11 vuotta sitten
vanhempi
sitoutus
0fa9bbf1fa

+ 5 - 0
Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst

@@ -72,6 +72,11 @@ The features known to this version of CMake are:
 
   .. _N2756: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm
 
+``cxx_nullptr``
+  Null pointer, as defined in N2431_.
+
+  .. _N2431: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
+
 ``cxx_override``
   Override control ``override`` keyword, as defined in N2928_.
 

+ 1 - 0
Modules/Compiler/GNU-CXX-FeatureTests.cmake

@@ -19,6 +19,7 @@ set(_cmake_feature_test_cxx_override "${GNU47_CXX11}")
 # TODO: Should be supported by GNU 4.6
 set(GNU46_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
 set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
+set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
 # TODO: Should be supported by GNU 4.5
 set(GNU45_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
 set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")

+ 1 - 0
Source/cmMakefile.cxx

@@ -54,6 +54,7 @@
   F(cxx_lambdas) \
   F(cxx_noexcept) \
   F(cxx_nonstatic_member_init) \
+  F(cxx_nullptr) \
   F(cxx_override) \
   F(cxx_static_assert) \
   F(cxx_strong_enums) \

+ 10 - 0
Tests/CompileFeatures/cxx_nullptr.cpp

@@ -0,0 +1,10 @@
+
+void someFunc(int*)
+{
+
+}
+
+void otherFunc()
+{
+  someFunc(nullptr);
+}