From 7b9fc88b045fd34df73e3cc864c9ac924a449cd3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 17 Jan 2015 16:06:51 +0100 Subject: Features: Remove outdated comment. --- Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 267d658..c265e73 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -59,7 +59,6 @@ set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}") # __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be # 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 "(__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}") -- cgit v0.12 From 782591350ced90d4289d220f91bdbdb4acec2ba6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 17 Jan 2015 15:58:45 +0100 Subject: Features: Test presence of cxx_auto_type with genex. The purpose of that test is to cover the case where the genex reports '1', and the feature is chosen to be present on all/most supported compilers. GNU 4.4 does not support cxx_nullptr. --- Tests/CompileFeatures/CMakeLists.txt | 6 +++--- Tests/CompileFeatures/genex_test.cpp | 13 +++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 106f29c..9de0da2 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -194,7 +194,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$ - HAVE_NULLPTR=$ + HAVE_AUTO_TYPE=$ HAVE_INHERITING_CONSTRUCTORS=$ HAVE_FINAL=$ HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$ @@ -204,7 +204,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_static_assert) target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$ - HAVE_NULLPTR=$ + HAVE_AUTO_TYPE=$ HAVE_INHERITING_CONSTRUCTORS=$ HAVE_FINAL=$ HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$ @@ -216,7 +216,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) target_link_libraries(CompileFeaturesGenex3 PRIVATE static_assert_iface) target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$ - HAVE_NULLPTR=$ + HAVE_AUTO_TYPE=$ HAVE_INHERITING_CONSTRUCTORS=$ HAVE_FINAL=$ HAVE_INHERITING_CONSTRUCTORS_AND_FINAL=$ diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 0389dbd..d9c8eec 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -17,9 +17,9 @@ struct B final : A #endif -#if !HAVE_NULLPTR -#error "Expect nullptr feature" -#else +#if !HAVE_AUTO_TYPE +# error Expect cxx_auto_type support +#endif #if !HAVE_INHERITING_CONSTRUCTORS # if EXPECT_INHERITING_CONSTRUCTORS @@ -51,13 +51,6 @@ struct B final : A # endif #endif -const char* getString() -{ - return nullptr; -} - -#endif - int main() { -- cgit v0.12 From c43a6dc5ec2ac57d8334beeabf90de43e8ddb829 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 14:36:01 +0100 Subject: Features: Update comment in test to match the code. After commit f13a2eb1 (Features: Adjust the RunCMake test to use more-common features., 2015-01-15). --- Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake index d2c95ec..684fb2b 100644 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake @@ -9,7 +9,7 @@ target_link_libraries(empty1 # When starting, $ is '0', so 'freeze' the # CXX_STANDARD at 98 during computation. $<$:empty2> - # This would add cxx_constexpr, but that would require CXX_STANDARD = 11, + # This would add cxx_static_assert, but that would require CXX_STANDARD = 11, # which is not allowed after freeze. Report an error. empty3 ) -- cgit v0.12 From c66e3317492709ab3b830024f67021dde67a7fe5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 14:37:34 +0100 Subject: Features: Use a more-common feature in cycle-test. We require that the $<$:empty2> generates a '1' when CXX11 is enabled. GNU 4.4 does not support cxx_nullptr, but does support cxx_auto_type. --- Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake index 684fb2b..09594bd 100644 --- a/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake +++ b/Tests/RunCMake/CompileFeatures/LinkImplementationFeatureCycle.cmake @@ -6,9 +6,9 @@ add_library(empty3 INTERFACE) target_compile_features(empty3 INTERFACE cxx_static_assert) target_link_libraries(empty1 - # When starting, $ is '0', so 'freeze' the + # When starting, $ is '0', so 'freeze' the # CXX_STANDARD at 98 during computation. - $<$:empty2> + $<$:empty2> # This would add cxx_static_assert, but that would require CXX_STANDARD = 11, # which is not allowed after freeze. Report an error. empty3 -- cgit v0.12 From 1ae2c6b2c9def9f0d0db3a808290d485eccf062c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 14:44:13 +0100 Subject: Features: Blacklist cxx_constexpr test for GNU 4.5. --- Tests/CompileFeatures/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 9de0da2..ccd6f30 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -52,6 +52,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) + # The cxx_constexpr feature happens to work (for *this* testcase) with + # GNU 4.5, but it is first documented as available with GNU 4.6. + list(REMOVE_ITEM CXX_non_features + cxx_constexpr + ) +endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) # The cxx_alignof feature happens to work (for *this* testcase) with # GNU 4.7, but it is first documented as available with GNU 4.8. -- cgit v0.12 From 2a5ca650c9f973c83fe3d5b070f6313e1bd536c1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 18 Jan 2015 14:59:40 +0100 Subject: Features: Wrap failure-test in UNIX condition. The use of GNU on non-UNIX for 'compile features' is not tested and is not well defined. --- Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index 401de95..5849417 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -25,12 +25,14 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) ) add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") - include(CheckCXXSourceCompiles) - check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" - file_include_works - ) - if (file_include_works) - message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.") + if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + include(CheckCXXSourceCompiles) + check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" + file_include_works + ) + if (file_include_works) + message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h was expected to cause an error, but did not.") + endif() endif() return() endif() -- cgit v0.12 From 004e1540e0870e9b3bde19ad16c4f50b7d22df73 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 17 Jan 2015 16:05:53 +0100 Subject: Features: Record for GNU 4.4. --- Help/release/dev/GNU-4.4-compile-features.rst | 5 +++++ Help/release/dev/GNU-4.6-compile-features.rst | 5 ----- Modules/Compiler/GNU-C-FeatureTests.cmake | 4 ++-- Modules/Compiler/GNU-C.cmake | 6 +++--- Modules/Compiler/GNU-CXX-FeatureTests.cmake | 8 +++----- Modules/Compiler/GNU-CXX.cmake | 6 +++--- 6 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 Help/release/dev/GNU-4.4-compile-features.rst delete mode 100644 Help/release/dev/GNU-4.6-compile-features.rst diff --git a/Help/release/dev/GNU-4.4-compile-features.rst b/Help/release/dev/GNU-4.4-compile-features.rst new file mode 100644 index 0000000..d5c1356 --- /dev/null +++ b/Help/release/dev/GNU-4.4-compile-features.rst @@ -0,0 +1,5 @@ +GNU-4.4-compile-features +------------------------ + +* The :manual:`Compile Features ` functionality + is now aware of features supported by GNU 4.4 to 4.6 compilers. diff --git a/Help/release/dev/GNU-4.6-compile-features.rst b/Help/release/dev/GNU-4.6-compile-features.rst deleted file mode 100644 index 059a075..0000000 --- a/Help/release/dev/GNU-4.6-compile-features.rst +++ /dev/null @@ -1,5 +0,0 @@ -GNU-4.6-compile-features ------------------------- - -* The :manual:`Compile Features ` functionality - is now aware of features supported by GNU 4.6 compilers. diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake index 7e840aa..d8e456c 100644 --- a/Modules/Compiler/GNU-C-FeatureTests.cmake +++ b/Modules/Compiler/GNU-C-FeatureTests.cmake @@ -1,5 +1,5 @@ -set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406") +set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404") # 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 @@ -9,7 +9,7 @@ set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406") 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") +set(GNU44_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") set(_cmake_feature_test_c_restrict "${GNU44_C99}") set(_cmake_feature_test_c_variadic_macros "${GNU44_C99}") diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index d5e747d..3036057 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -1,7 +1,7 @@ include(Compiler/GNU) __compiler_gnu(C) -if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) +if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") @@ -12,7 +12,7 @@ endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") -elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) +elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") endif() @@ -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.6) + if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) _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) diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index c265e73..5fc3deb 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/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__) >= 406") +set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404") set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L") set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}") @@ -67,14 +67,12 @@ set(_cmake_feature_test_cxx_noexcept "${GNU46_CXX11}") set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}") set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}") set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}") -# TODO: Should be supported by GNU 4.5 -set(GNU45_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +set(GNU45_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}") set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}") set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}") set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}") -# TODO: Should be supported by GNU 4.4 -set(GNU44_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +set(GNU44_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && ${GNU_CXX0X_DEFINED}") set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}") set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}") set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}") diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index eeada86..c471daf 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -11,7 +11,7 @@ else() endif() endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) # Supported since 4.3 set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") @@ -20,7 +20,7 @@ endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") -elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) +elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) # 4.3 supports 0x variants set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") @@ -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.6) + if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) if (_result EQUAL 0) _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) endif() -- cgit v0.12