Skip to content

Commit b50eec0

Browse files
committed
stdint.h: make redefinition of stdint types optional
PR zephyrproject-rtos#16645 streamlined stdint.h type definitions. This has an unfortunate side effect that any legacy code which assumed default, compiler provided types will now generate warnings any time type mismatch is detected during the compilation process. Redefining stdint types also significantly increases porting effort when building an existing bare metal application with Zephyr. This PR makes redefinition of stdint types optional. Signed-off-by: Piotr Mienkowski <[email protected]>
1 parent 33e6384 commit b50eec0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ zephyr_compile_options(
236236

237237
# @Intent: Enforce standard integer type correspondance to match Zephyr usage.
238238
# (must be after compiler specific flags)
239+
if(CONFIG_ZEPHYR_STDINT)
239240
toolchain_cc_imacros(${ZEPHYR_BASE}/include/toolchain/zephyr_stdint.h)
241+
endif()
240242

241243
# Common toolchain-agnostic assembly flags
242244
zephyr_compile_options(

lib/libc/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,12 @@ config MINIMAL_LIBC_LL_PRINTF
8383
Build with long long printf enabled. This will increase the size of
8484
the image.
8585

86+
config ZEPHYR_STDINT
87+
bool "Enforce standard integer types to match Zephyr usage"
88+
default y
89+
help
90+
This option enforces standard integer types such as uint32_t, int16_t
91+
to match Zephyr usage. When disabled default definitions provided by
92+
the compiler are used.
93+
8694
endmenu

0 commit comments

Comments
 (0)