-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Description
Describe the bug
While building the hello_world sample for qemu_x86 with -Wall -Wextra flags,
two -Wcast-function-type warnings are emitted in lib/os/printk.c.
These warnings indicate a cast between incompatible function pointer types, which is
undefined behavior per the C11 standard (§6.3.2.3) and can cause issues on
certain architectures or with stricter compiler versions.
build output
lib/os/printk.c:110:51: warning: cast between incompatible function types
from 'int (*)(int, void )' to 'int ()(char, FILE *)' [-Wcast-function-type]
lib/os/printk.c:131:50: warning: cast between incompatible function types
from 'int (*)(int, void )' to 'int ()(char, FILE *)' [-Wcast-function-type]
Regression
- This is a regression.
Steps to reproduce
west build -b qemu_x86 samples/hello_world --pristine -- -DEXTRA_CFLAGS="-Wall -Wextra"
Relevant log output
Users/gokul/Documents/zephyrproject/zephyr/lib/os/printk.c:110:51: warning: cast between incompatible function types from 'int (*)(int, void *)' to 'int (*)(char, FILE *)' [-Wcast-function-type]
/Users/gokul/Documents/zephyrproject/zephyr/lib/os/printk.c:131:50: warning: cast between incompatible function types from 'int (*)(int, void *)' to 'int (*)(char, FILE *)' [-Wcast-function-type]Impact
Annoyance – Minor irritation; no significant impact on usability or functionality.
Environment
- **Zephyr version:v4.3.0
- **Board: qemu_x86
- **OS: macOS
- **SDK version : 0.17.4
Additional Context
No response