kconfig: Add symbols for GNU C Extensions

Add a symbol to enable GNU C Extensions. And a hidden option for
toolchains to signal GNU Extensions support.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-04-15 19:28:45 +02:00 committed by Fabio Baltieri
parent 86b721c45e
commit a599ed13a1
7 changed files with 42 additions and 0 deletions

View file

@ -971,6 +971,10 @@ if(NOT DEFINED CSTD)
else()
message(FATAL_ERROR "Unreachable code. Expected C standard to have been chosen.")
endif()
if(CONFIG_GNU_C_EXTENSIONS)
string(REPLACE "c" "gnu" CSTD "${CSTD}")
endif()
else()
message(DEPRECATION
"Global CSTD property is deprecated, see Kconfig.zephyr for C Standard options.")

View file

@ -403,6 +403,19 @@ config STD_C23
endchoice
config TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS
bool
default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr"
help
Hidden option to signal that toolchain supports GNU Extensions.
config GNU_C_EXTENSIONS
bool "GNU C Extensions"
depends on TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS
help
Enable GNU C Extensions. GNU C provides several language features
not found in ISO standard C.
config CODING_GUIDELINE_CHECK
bool "Enforce coding guideline rules"
help

View file

@ -23,3 +23,7 @@ config ARMCLANG_STD_LIBC
not provided by ARM Compiler standard libraries.
endchoice
config TOOLCHAIN_ARMCLANG_SUPPORTS_GNU_EXTENSIONS
def_bool y
select TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS

View file

@ -7,3 +7,10 @@ config TOOLCHAIN_CROSS_COMPILE_SUPPORTS_THREAD_LOCAL_STORAGE
help
Set this if the cross-compile toolchain being used for the build
supports thread local storage.
config TOOLCHAIN_CROSS_COMPILE_SUPPORTS_GNU_EXTENSIONS
bool "Cross-compile toolchain supports GNU Extensions"
select TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS
help
Set this if the cross-compile toolchain being used for the build
supports GNU Extensions.

View file

@ -7,3 +7,7 @@ config TOOLCHAIN_GNUARMEMB
def_bool y
select HAS_NEWLIB_LIBC_NANO
select NEWLIB_LIBC_SUPPORTED
config TOOLCHAIN_GNUARMEMB_SUPPORTS_GNU_EXTENSIONS
def_bool y
select TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS

View file

@ -0,0 +1,6 @@
# Copyright (c) 2024 Basalte bv
# SPDX-License-Identifier: Apache-2.0
config TOOLCHAIN_HOST_SUPPORTS_GNU_EXTENSIONS
def_bool y
select TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS

View file

@ -22,3 +22,7 @@ config TOOLCHAIN_LLVM_SUPPORTS_THREAD_LOCAL_STORAGE
depends on RISCV
def_bool y
select TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
config TOOLCHAIN_LLVM_SUPPORTS_GNU_EXTENSIONS
def_bool y
select TOOLCHAIN_SUPPORTS_GNU_EXTENSIONS