summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/Compiler/SunPro-C-FeatureTests.cmake14
-rw-r--r--Modules/Compiler/SunPro-C.cmake15
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt10
-rw-r--r--Tests/CompileFeatures/default_dialect.c3
4 files changed, 41 insertions, 1 deletions
diff --git a/Modules/Compiler/SunPro-C-FeatureTests.cmake b/Modules/Compiler/SunPro-C-FeatureTests.cmake
new file mode 100644
index 0000000..cccf3ae
--- /dev/null
+++ b/Modules/Compiler/SunPro-C-FeatureTests.cmake
@@ -0,0 +1,14 @@
+set(_cmake_oldestSupported "__SUNPRO_C >= 0x5130")
+
+set(SunPro_C11 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L || __STDC_VERSION__ >= 199901L && defined(__C11FEATURES__))")
+set(_cmake_feature_test_c_static_assert "${SunPro_C11}")
+unset(SunPro_C11)
+
+set(SunPro_C99 "${_cmake_oldestSupported} && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${SunPro_C99}")
+set(_cmake_feature_test_c_variadic_macros "${SunPro_C99}")
+unset(SunPro_C99)
+
+set(SunPro_C90 "${_cmake_oldestSupported}")
+set(_cmake_feature_test_c_function_prototypes "${SunPro_C90}")
+unset(SunPro_C90)
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 29c2f22..ac88e6f 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -43,5 +43,20 @@ endif()
__compiler_check_default_language_standard(C 5.11 90 5.14 11)
+macro(cmake_record_c_compile_features)
+ set(_result 0)
+ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
+ if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(11)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_c(99)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_c(90)
+ endif()
+ endif()
+endmacro()
+
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 2a307d0..bb18543 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -239,6 +239,16 @@ if (CMAKE_C_COMPILE_FEATURES)
EXPECT_C_STATIC_ASSERT=0
)
endif()
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "SunPro")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.13)
+ list(APPEND expected_defs
+ EXPECT_C_STATIC_ASSERT=1
+ )
+ else()
+ list(APPEND expected_defs
+ EXPECT_C_STATIC_ASSERT=0
+ )
+ endif()
endif()
list(APPEND expected_defs
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
index 0e67095..4debd94 100644
--- a/Tests/CompileFeatures/default_dialect.c
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -11,7 +11,8 @@
#if !DEFAULT_C90
#error Buildsystem error
#endif
-#if defined(__STDC_VERSION__)
+#if defined(__STDC_VERSION__) && \
+ !(defined(__SUNPRO_C) && __STDC_VERSION__ == 199409L)
#error Unexpected __STDC_VERSION__ definition
#endif
#endif