浏览代码

Features: Record for GNU 4.6.

Adjust the CompileFeatures genex_test for the expectation of the
OVERRIDE_CONTROL feature group.
Stephen Kelly 10 年之前
父节点
当前提交
b15c008fac

+ 2 - 2
Modules/Compiler/GNU-C-FeatureTests.cmake

@@ -1,12 +1,12 @@
 
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
 
 # GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
 # to 201000L.  As the former is strictly greater than the latter, test only
 # for the latter.  If in the future CMake learns about a C feature which was
 # introduced with GNU 4.7, that should test for the correct version, similar
 # to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests.
-set(GNU46_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
+set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
 set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
 # Since 4.4 at least:
 set(GNU44_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")

+ 1 - 1
Modules/Compiler/GNU-C.cmake

@@ -29,7 +29,7 @@ macro(cmake_record_c_compile_features)
   endmacro()
 
   set(_result 0)
-  if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
+  if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
     _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
     if (_result EQUAL 0)
       _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)

+ 2 - 2
Modules/Compiler/GNU-CXX-FeatureTests.cmake

@@ -2,7 +2,7 @@
 # Reference: http://gcc.gnu.org/projects/cxx0x.html
 # http://gcc.gnu.org/projects/cxx1y.html
 
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406")
 
 set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L")
 set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}")
@@ -60,7 +60,7 @@ set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
 # defined in the future.
 set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))")
 # TODO: Should be supported by GNU 4.6
-set(GNU46_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}")
+set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}")
 set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
 set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}")
 set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}")

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

@@ -45,7 +45,7 @@ macro(cmake_record_cxx_compile_features)
   if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
     _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
   endif()
-  if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+  if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
     if (_result EQUAL 0)
       _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
     endif()

+ 6 - 2
Tests/CompileFeatures/CMakeLists.txt

@@ -142,23 +142,24 @@ if (CMAKE_CXX_COMPILE_FEATURES)
   add_executable(IfaceCompileFeatures main.cpp)
   target_link_libraries(IfaceCompileFeatures iface)
 
-  add_definitions(-DEXPECT_OVERRIDE_CONTROL=1)
-
   if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
       add_definitions(
+        -DEXPECT_OVERRIDE_CONTROL=1
         -DEXPECT_INHERITING_CONSTRUCTORS=1
         -DEXPECT_FINAL=1
         -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
       )
     elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
       add_definitions(
+        -DEXPECT_OVERRIDE_CONTROL=1
         -DEXPECT_INHERITING_CONSTRUCTORS=0
         -DEXPECT_FINAL=1
         -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0
       )
     else()
       add_definitions(
+        -DEXPECT_OVERRIDE_CONTROL=0
         -DEXPECT_INHERITING_CONSTRUCTORS=0
         -DEXPECT_FINAL=0
         -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0
@@ -166,6 +167,7 @@ if (CMAKE_CXX_COMPILE_FEATURES)
     endif()
   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
     add_definitions(
+      -DEXPECT_OVERRIDE_CONTROL=1
       -DEXPECT_INHERITING_CONSTRUCTORS=1
       -DEXPECT_FINAL=1
       -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
@@ -173,12 +175,14 @@ if (CMAKE_CXX_COMPILE_FEATURES)
   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
     if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
       add_definitions(
+        -DEXPECT_OVERRIDE_CONTROL=1
         -DEXPECT_INHERITING_CONSTRUCTORS=1
         -DEXPECT_FINAL=1
         -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1
       )
     else()
       add_definitions(
+        -DEXPECT_OVERRIDE_CONTROL=1
         -DEXPECT_INHERITING_CONSTRUCTORS=0
         -DEXPECT_FINAL=1
         -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0