summaryrefslogtreecommitdiffstats
path: root/Tests/CompileFeatures
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'features-c++20'Brad King2018-04-022-1/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 8570dc7f64 Help: Update compiler versions in cmake-compile-features.7.rst 874d3d2948 Help: Add release note for C++ 20 support 7f295b1bd3 Features: Activate C++ 20 support for Clang 5.0+ 71cb8ce3a1 Features: Activate C++ 20 support for GNU 8.0+ 8f146c4508 Features: Activate C++ 20 support for MSVC 19.12.25835+ 7fe580a362 Features: Add infrastructure for C++ 20 language standard 1b328e09a3 Features: Use -std=c++17 for C++ 17 on Clang 5.0+ 0bc3e5788a Features: Use -std=c++17 for C++ 17 on GNU 8.0+ Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1892
| * Features: Add infrastructure for C++ 20 language standardBrad King2018-03-272-1/+7
| | | | | | | | Issue: #17849
* | Features: Record C features for MSVCBrad King2018-03-291-0/+5
| | | | | | | | | | | | | | | | | | The MSVC C compiler has no notion of C language standards or flags. Tell CMake to assume that all language standards are available. Record available C language features depending on the version of the compiler. Fixes: #17858
* | Features: Do not assume c_restrict support in CompileFeatures testBrad King2018-03-281-1/+11
| | | | | | | | Define `EXPECT_C_RESTRICT` separately for each compiler.
* | Features: Fix CompileFeatures test checks for CBrad King2018-03-281-3/+9
|/ | | | Compare the HAVE_ and EXPECT_ macros as we do for CXX.
* Features: Record initializer list support for Intel 14 and aboveBrad King2018-03-161-0/+6
| | | | | | | | | | | | | | | Features recorded by commit v3.6.0-rc1~120^2~5 (Features: Record standards and features for Intel C++ on UNIX, 2016-04-28) for the Intel compiler left out initializer list support because our test case in `Tests/CompileFeatures/cxx_generalized_initializers.cpp` caused an internal compiler error. It turns out this is because the Intel compiler asserts the `initializer_list` constructor signatures to verify that they match its own `<initializer_list>` header. It was our dummy implementation used to test the language feature without any headers that caused the ICE. Revise it to use a constructor signature accepted by the Intel compiler. Fixes: #17829
* Tests: Make CompileFeatures C dialect check consistent with implBrad King2018-02-211-1/+1
| | | | | | | | `Modules/CMakeCCompilerId.c.in` will report the C dialect as 11 whenever `__STDC_VERSION__` indicates *at least* C 11. Make the test consistent with this. We already do this for the C++ case. Fixes: #17740
* clang-format: format all code as Cpp11Daniel Pfeifer2017-08-303-11/+12
|
* Features: Fix COMPILE_FEATURES genex for C++ 14 and 17 featuresBrad King2017-08-082-0/+20
| | | | | | When `CXX_STANDARD` is not at least 14 or 17, features enabled by the compiler for those standards should not be reported as existing by the `COMPILE_FEATURES` genex. Fix the implementation and add a test.
* MSVC: Add flags for C++ language standardsBrad King2017-07-171-9/+14
| | | | | | | | | | | Visual Studio 2015 Update 3 introduced the notion of language standard levels to MSVC. The language standard level is defined in `_MSVC_LANG` instead of `__cplusplus`. It also added support for the `-std:c++14` and `-std:c++latest` flags, although the compiler defaults to its C++14 mode anyway. Visual Studio 2017 Update 3 will introduce support for the `-std:c++17` flag. Fixes: #16482
* CompileFeatures: Makes tests work with meta-feature onlyChuck Atkins2017-05-291-6/+17
|
* Features: Record features for SunPro C 5.13 and 5.14Brad King2017-05-112-1/+12
|
* clang-format.bash: Use Git attributes to mark files for formattingBrad King2017-02-221-0/+2
|
* CompileFeatures Test: make sure the target "CompileFeatures" is always definedRolf Eike Beer2017-01-301-10/+8
| | | | | | Everything in there guards against unsupported compilers already, so no need to skip the whole file if no features are defined. This in turn allows to have a simpler fallback in case there is no C++ auto_type feature available.
* Tests: use cxx_auto_type only if actually availableRolf Eike Beer2017-01-251-0/+3
| | | | | The presence of CMAKE_CXX_COMPILE_FEATURES doesn't mean cxx_auto_type is always available.
* Features: Add infrastructure for C++ 17 language standardBrad King2016-12-022-2/+7
| | | | Issue: #16468
* Features: Suppress c_static_assert test coverage on Intel <= 15Brad King2016-11-101-0/+9
| | | | It works on some pre-15.0.2 versions but not others.
* Features: Test feature propagation with language standard meta-featureBrad King2016-11-021-4/+4
| | | | | | | The `cxx_static_assert` feature may be available in C++ 98 mode of some compilers or not available at all in others. Intstead of using an individual feature to test propagation of a feature requiring C++ 11, use the `std_cxx_11` meta-feature that has exactly this meaning.
* Features: Add meta-features requesting awareness of a particular standardBrad King2016-11-021-0/+2
| | | | | | | | | | A common use case of `target_compile_features` is simply to specify that the compiler should be run in a mode that is aware of e.g. C++11. Some projects simply specify a particular C++11-only feature to request this. Provide a first-class way to do this by naming features after the corresponding language standard. Record them as always available in the corresponding standard level so that requesting them always ensures that standard (or higher) is used.
* Features: Fix cxx_right_angle_brackets compiler feature testAlex Wang2016-10-251-1/+3
| | | | | | | The clang-format pass in commit v3.6.0-rc1~54^2~1 (Revise C++ coding style using clang-format, 2016-05-16) changed the template right angle brackets from `>>` to `> >`, which defeats the purpose of this test. Change it back and exclude this content from formatting.
* Revise C++ coding style using clang-formatKitware Robot2016-05-1642-192/+243
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Tests: Protect unicode literals from clang-format Cpp03 formattingBrad King2016-05-111-0/+2
| | | | | | | | | | | Since CMake is written in C++98 any clang-format configuration must set `Standard` to `Cpp03` so that `A<A<int> >` is not rewritten as `A<A<int>>`. However, this will cause `U"foo"` to be rewritten as `U "foo"`. Add markup to turn clang-format off in the one place that the latter case occurs so that we do not need a separate `.clang-format` config file for it. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Features: Record standards and features for Intel C on UNIXRobert Maynard2016-04-281-0/+10
| | | | | Record features for Intel C 12.1 and above. Skip this for now on Windows (where Intel C simulates MSVC).
* Features: Record standards and features for Intel C++ on UNIXLevi Morrison2016-04-281-0/+72
| | | | Skip this for now on Windows (where Intel C++ simulates MSVC).
* Features: Update MSVC features for VS 2015 RTMBrad King2015-07-211-6/+0
| | | | | VS 2015 RTM completed support for constexpr and attribute features. Update our feature table and test accordingly.
* Features: VS 2013 Update 3 supports initializer lists (#15494)Brad King2015-04-061-2/+2
| | | | | | | | | | | VS 2013 originally claimed to support initializer lists but a bug was found in which it generated bad code silently. For this reason we previously considered support to not be present. However, Update 3 adds a hard error on cases that previously generated bad code, so it is now safe to use initializer lists with VS 2013 Update 3 or greater. At worst a compiler error will be issued in the cases that do not work, but that is no different from any other compiler-specific workaround a project code may need.
* Tests: Fix CompileFeatures cxx_generalized_initializers exampleBrad King2015-04-061-2/+6
| | | | | | | | | The only reason this failed to compile on VS 2013 was because the compiler uses different initializer_list constructor argument types than our dummy implementation. The standard does not specify the non-default constructor argument types for initializer_list. Use a template to match any two-arg constructor a compiler might select (e.g. begin/end or begin/len). Use #error to preserve the error on VS 2013.
* Features: Fix C90 feature detection.Stephen Kelly2015-02-042-0/+70
| | | | | | | | | | | | | | | This bug caused c_function_prototypes to not be recorded at configure time when compiling with -std=gnu99 or similar. In the case of feature recording, that was not a problem, because the logic in CMakeDetermineCompileFeatures.cmake currently assumes that a feature present for an earlier standard is present for a later standard. However, the detection strings are also used in WriteCompilerDetectionHeader, so the feature macro has been defined to '0' when using a later language dialect. Fix that by not checking the existence of the __STDC_VERSION__ macro at all when detecting C90 features.
* Features: Record for MSVC 2010-2015Robert Maynard2015-01-301-0/+48
| | | | | | | Also, in WCDH add MSVC Compatibility for cxx_align{of,as}. Co-Author: Stephen Kelly <steveire@gmail.com> Co-Author: Brad King <brad.king@kitware.com>
* Features: Define meaning for no language standard defaultBrad King2015-01-291-16/+20
| | | | | | | | | | | | Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that the toolchain has no notion of lanuage standard levels. In this case the <LANG>_STANDARD[_REQUIRED] properties will have no effect. Update the RunCMake.CompileFeatures test to exclude the LinkImplementationFeatureCycle test when there is no standard default. It can never fail because no use of specific features will adjust the CXX_STANDARD level required for any target since the standard levels have no meaning in this case.
* Merge topic 'test-features-enforce-expectation'Brad King2015-01-271-0/+15
|\ | | | | | | | | | | 67e76e82 Features: Fix test to reject missing expectation definitions 3046be77 Features: Emit a test failure if 'override' is present but not expected
| * Features: Fix test to reject missing expectation definitionsBrad King2015-01-261-0/+12
| | | | | | | | | | | | | | | | | | Whenever feature support is added to a compiler, the CompileFeatures test needs to be updated to set expected availability of features. Add #error directives to ensure the test fails if expectations are not set. Suggested-by: Stephen Kelly <steveire@gmail.com>
| * Features: Emit a test failure if 'override' is present but not expectedStephen Kelly2015-01-261-0/+3
| |
* | Merge topic 'GNU-4.4-compile-features'Brad King2015-01-231-0/+8
|\ \ | | | | | | | | | | | | 374a66b5 Features: Blacklist raw string literals test for GNU 4.4
| * | Features: Blacklist raw string literals test for GNU 4.4Brad King2015-01-221-0/+8
| | | | | | | | | | | | | | | RedHat gcc 4.4.7-11 supports raw string literals, so simply blacklist the test for its rejection.
* | | Merge topic 'GNU-4.4-compile-features'Brad King2015-01-222-1/+12
|\ \ \ | |/ / | | / | |/ |/| | | | | 965a50dc Features: Fix GNU 4.4 and 4.5 C standard level flags 7f4154a4 Features: Fix CompileFeatures non-feature tests for space in path f40c19b5 Features: Fix CompileFeatures test for C non-features
| * Features: Fix CompileFeatures non-feature tests for space in pathBrad King2015-01-211-1/+2
| | | | | | | | | | | | Fix the <lang>_non_features try_compile calls to work correctly when there is a space in the path. Otherwise they all fail due to the space instead of the lack of a feature.
| * Features: Fix CompileFeatures test for C non-featuresBrad King2015-01-211-0/+10
| | | | | | | | | | Add a "feature_test.c" file corresponding to "feature_test.cpp" but for the C language. This source will be needed by C_non_features entries.
* | Merge topic 'GNU-4.4-compile-features'Brad King2015-01-192-13/+14
|\ \ | |/ | | | | | | | | | | | | | | | | | | 004e1540 Features: Record for GNU 4.4. 2a5ca650 Features: Wrap failure-test in UNIX condition. 1ae2c6b2 Features: Blacklist cxx_constexpr test for GNU 4.5. c66e3317 Features: Use a more-common feature in cycle-test. c43a6dc5 Features: Update comment in test to match the code. 78259135 Features: Test presence of cxx_auto_type with genex. 7b9fc88b Features: Remove outdated comment.
| * Features: Blacklist cxx_constexpr test for GNU 4.5.Stephen Kelly2015-01-181-0/+8
| |
| * Features: Test presence of cxx_auto_type with genex.Stephen Kelly2015-01-172-13/+6
| | | | | | | | | | | | 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.
* | Features: Record for SolarisStudio 12.4.Stephen Kelly2015-01-171-0/+18
| | | | | | | | It has similar C++11 capabilities compared to GCC 4.8.
* | Features: Adjust cxx_variadic_templates unit test for SolarisStudio.Stephen Kelly2015-01-171-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | The change in commit 1f19ac4d (Features: Adjust cxx_variadic_templates unit test for GNU < 4.7., 2015-01-11) pacified GNU 4.6, but leaves SolarisStudio 12.4 complaining: "cxx_variadic_templates.cpp", line 5: Error: Partial specialization for Interface<Is...> has identical arguments. 1 Error(s) detected. Implement a preprocessor test for using the partial specialization workaround needed by GNU 4.6.
* | Features: Use variable in cxx_inheriting_constructors test.Stephen Kelly2015-01-171-1/+1
| | | | | | | | Avoid warning with SolarisStudio.
* | Features: Ensure that the cxx_auto_type test is correct.Stephen Kelly2015-01-171-1/+8
|/ | | | | | | | | | | | | | | | | | | | SolarisStudio considers 'auto' to be a storage class specifier in C++98 mode (as appropriate), and considers variables without a specified type to be of type int. So, it treats auto x = 3.14; as auto int x = 3.14; which in C++98 mode is equivalent to int x = 3.14; and it does not fail to compile as expected. Change the test to use a reference so that the type must be known.
* Features: Record for GNU 4.6.Stephen Kelly2015-01-151-2/+6
| | | | | Adjust the CompileFeatures genex_test for the expectation of the OVERRIDE_CONTROL feature group.
* Features: Adjust cxx_variadic_templates unit test for GNU < 4.7.Stephen Kelly2015-01-151-2/+2
| | | | | | | | | | | | | | The unit test for this fails with GNU 4.6: Building CXX object CMakeFiles/test_cxx_variadic_templates.dir/cxx_variadic_templates.cpp.o CompileFeatures/cxx_variadic_templates.cpp: In static member function ‘static int Interface<I, Is>::accumulate()’: CompileFeatures/cxx_variadic_templates.cpp:18:31: sorry, unimplemented: cannot expand ‘Is ...’ into a fixed-length argument list CMakeFiles/test_cxx_variadic_templates.dir/build.make:54: recipe for target 'CMakeFiles/test_cxx_variadic_templates.dir/cxx_variadic_templates.cpp.o' failed The workaround is to use a specialization: http://stackoverflow.com/questions/1989552 http://stackoverflow.com/questions/11297376
* Features: Extend the generalized_initializers test for GNU < 4.7.Stephen Kelly2015-01-151-0/+1
| | | | | That compiler requires a different initializer_list constructor, so update the test to match.
* Features: Update the default_dialect test for old GNU-like compilers.Stephen Kelly2015-01-151-1/+1
| | | | | Prior to GNU 4.7, GNU defined __cplusplus incorrectly, and defined __GXX_EXPERIMENTAL_CXX0X__ in C++11 mode.
* Features: Extend the tests for the COMPILE_FEATURES genex.Stephen Kelly2015-01-152-0/+81
|