summaryrefslogtreecommitdiffstats
path: root/Tests/CompileFeatures
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt19
-rw-r--r--Tests/CompileFeatures/default_dialect.cpp6
-rw-r--r--Tests/CompileFeatures/genex_test.c12
3 files changed, 32 insertions, 5 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index b560acd..e94473f 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -227,43 +227,58 @@ if (C_expected_features)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=1
)
else()
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=0
)
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang"
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=1
)
elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15)
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=1
)
else()
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=0
)
endif()
+ elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ list(APPEND expected_defs
+ EXPECT_C_RESTRICT=0
+ EXPECT_C_STATIC_ASSERT=0
+ )
elseif (CMAKE_C_COMPILER_ID STREQUAL "SunPro")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.13)
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=1
)
else()
list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
EXPECT_C_STATIC_ASSERT=0
)
endif()
+ else()
+ list(APPEND expected_defs
+ EXPECT_C_RESTRICT=1
+ )
endif()
list(APPEND expected_defs
EXPECT_C_FUNCTION_PROTOTYPES=1
- EXPECT_C_RESTRICT=1
)
target_compile_definitions(CompileFeaturesGenex_C PRIVATE
@@ -280,6 +295,7 @@ if (CMAKE_CXX_COMPILE_FEATURES)
if (std_flag_idx EQUAL -1)
add_executable(default_dialect default_dialect.cpp)
target_compile_definitions(default_dialect PRIVATE
+ DEFAULT_CXX20=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},20>
DEFAULT_CXX17=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},17>
DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14>
DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11>
@@ -434,6 +450,7 @@ else()
HAVE_CXX_STD_11=$<COMPILE_FEATURES:cxx_std_11>
HAVE_CXX_STD_14=$<COMPILE_FEATURES:cxx_std_14>
HAVE_CXX_STD_17=$<COMPILE_FEATURES:cxx_std_17>
+ HAVE_CXX_STD_20=$<COMPILE_FEATURES:cxx_std_20>
)
endif()
diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp
index 0de1125..7ddcfe7 100644
--- a/Tests/CompileFeatures/default_dialect.cpp
+++ b/Tests/CompileFeatures/default_dialect.cpp
@@ -8,7 +8,11 @@ struct Outputter;
#define CXX_STD __cplusplus
#endif
-#if DEFAULT_CXX17
+#if DEFAULT_CXX20
+#if CXX_STD <= 201703L
+Outputter<CXX_STD> o;
+#endif
+#elif DEFAULT_CXX17
#if CXX_STD <= 201402L
Outputter<CXX_STD> o;
#endif
diff --git a/Tests/CompileFeatures/genex_test.c b/Tests/CompileFeatures/genex_test.c
index 1d54840..e58d793 100644
--- a/Tests/CompileFeatures/genex_test.c
+++ b/Tests/CompileFeatures/genex_test.c
@@ -8,7 +8,7 @@
#error EXPECT_C_RESTRICT not defined
#endif
-#if !EXPECT_C_STATIC_ASSERT
+#if !HAVE_C_STATIC_ASSERT
#if EXPECT_C_STATIC_ASSERT
#error "Expect c_static_assert feature"
#endif
@@ -18,11 +18,17 @@
#endif
#endif
-#if !EXPECT_C_FUNCTION_PROTOTYPES
+#if !HAVE_C_FUNCTION_PROTOTYPES
+#if EXPECT_C_FUNCTION_PROTOTYPES
#error Expect c_function_prototypes support
#endif
+#else
+#if !EXPECT_C_FUNCTION_PROTOTYPES
+#error Expect no c_function_prototypes support
+#endif
+#endif
-#if !EXPECT_C_RESTRICT
+#if !HAVE_C_RESTRICT
#if EXPECT_C_RESTRICT
#error Expect c_restrict support
#endif