2026-05-08 1:26 AM - last edited on 2026-05-08 1:31 AM by Andrew Neil
If the user uses "-Wundef" the header "stm32u3xx_hal_def.h" creates a lot of warnings due to a missing check if a preprocessor macro is defined before evaluating it.
The warning gets emmited by the following #ifs used in STM32Cube FW_U3 V1.3.0 inside "stm32u3xx_hal_def.h":
#if defined ( __CC_ARM ) || ((__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )e.g. in line 142
This is how it was correctly checked in e.g. the STM32Cube FW_G0 V1.6.3 in the hal def header for the stm32g0 hal:
#if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
Best Regards