Features: Record features for SunPro C 5.13 and 5.14

This commit is contained in:
Brad King 2017-05-11 15:56:27 -04:00
parent 8e2f3582eb
commit 5d13fe2822
4 changed files with 41 additions and 1 deletions

View File

@ -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)

View File

@ -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>")

View File

@ -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

View File

@ -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