kconfig: Add symbols for C standard
Add symbols to select a C standard. Next to an option, hidden symbols are available to select the minimum. This allows subsystems or modules to select the least compliant C standard supported. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
32c9614bd8
commit
86b721c45e
2 changed files with 83 additions and 1 deletions
|
@ -957,7 +957,24 @@ if(CONFIG_USERSPACE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_property(CSTD GLOBAL PROPERTY CSTD)
|
get_property(CSTD GLOBAL PROPERTY CSTD)
|
||||||
set_ifndef(CSTD c99)
|
if(NOT DEFINED CSTD)
|
||||||
|
if(CONFIG_STD_C23)
|
||||||
|
set(CSTD c2x)
|
||||||
|
elseif(CONFIG_STD_C17)
|
||||||
|
set(CSTD c17)
|
||||||
|
elseif(CONFIG_STD_C11)
|
||||||
|
set(CSTD c11)
|
||||||
|
elseif(CONFIG_STD_C99)
|
||||||
|
set(CSTD c99)
|
||||||
|
elseif(CONFIG_STD_C90)
|
||||||
|
set(CSTD c90)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unreachable code. Expected C standard to have been chosen.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(DEPRECATION
|
||||||
|
"Global CSTD property is deprecated, see Kconfig.zephyr for C Standard options.")
|
||||||
|
endif()
|
||||||
|
|
||||||
# @Intent: Obtain compiler specific flag for specifying the c standard
|
# @Intent: Obtain compiler specific flag for specifying the c standard
|
||||||
zephyr_compile_options(
|
zephyr_compile_options(
|
||||||
|
|
|
@ -338,6 +338,71 @@ endmenu
|
||||||
|
|
||||||
menu "Compiler Options"
|
menu "Compiler Options"
|
||||||
|
|
||||||
|
config REQUIRES_STD_C99
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Hidden option to select compiler support C99 standard or higher.
|
||||||
|
|
||||||
|
config REQUIRES_STD_C11
|
||||||
|
bool
|
||||||
|
select REQUIRES_STD_C99
|
||||||
|
help
|
||||||
|
Hidden option to select compiler support C11 standard or higher.
|
||||||
|
|
||||||
|
config REQUIRES_STD_C17
|
||||||
|
bool
|
||||||
|
select REQUIRES_STD_C11
|
||||||
|
help
|
||||||
|
Hidden option to select compiler support C17 standard or higher.
|
||||||
|
|
||||||
|
config REQUIRES_STD_C23
|
||||||
|
bool
|
||||||
|
select REQUIRES_STD_C17
|
||||||
|
help
|
||||||
|
Hidden option to select compiler support C23 standard or higher.
|
||||||
|
|
||||||
|
choice STD_C
|
||||||
|
prompt "C Standard"
|
||||||
|
default STD_C23 if REQUIRES_STD_C23
|
||||||
|
default STD_C17 if REQUIRES_STD_C17
|
||||||
|
default STD_C11 if REQUIRES_STD_C11
|
||||||
|
default STD_C99
|
||||||
|
help
|
||||||
|
C Standards.
|
||||||
|
|
||||||
|
config STD_C90
|
||||||
|
bool "C90"
|
||||||
|
depends on !REQUIRES_STD_C99
|
||||||
|
help
|
||||||
|
1989 C standard as completed in 1989 and ratified by ISO/IEC
|
||||||
|
as ISO/IEC 9899:1990. This version is known as "ANSI C".
|
||||||
|
|
||||||
|
config STD_C99
|
||||||
|
bool "C99"
|
||||||
|
depends on !REQUIRES_STD_C11
|
||||||
|
help
|
||||||
|
1999 C standard.
|
||||||
|
|
||||||
|
config STD_C11
|
||||||
|
bool "C11"
|
||||||
|
depends on !REQUIRES_STD_C17
|
||||||
|
help
|
||||||
|
2011 C standard.
|
||||||
|
|
||||||
|
config STD_C17
|
||||||
|
bool "C17"
|
||||||
|
depends on !REQUIRES_STD_C23
|
||||||
|
help
|
||||||
|
2017 C standard, addresses defects in C11 without introducing
|
||||||
|
new language features.
|
||||||
|
|
||||||
|
config STD_C23
|
||||||
|
bool "C23"
|
||||||
|
help
|
||||||
|
2023 C standard.
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
config CODING_GUIDELINE_CHECK
|
config CODING_GUIDELINE_CHECK
|
||||||
bool "Enforce coding guideline rules"
|
bool "Enforce coding guideline rules"
|
||||||
help
|
help
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue