Warning: "unknown attribute 'optimize'" (CubeIDE VSCode 3.8.0 & clang & CubeMX 6.17.0)
Hi ST-Team,
context:
- STM32H753ZI NUCLEO Board
- VSCode with STM32CubeIDE Extension
- Clang Compiler
after follow updates
- STM32CubeIDE VSCode from v3.7.0 to v3.8.0
- STM32CubeMx from v6.16.1 to v6.17.0
incl. MCU Package H7 from v1.12.1 to v1.13.0
incl. Azure RTOS for H7 from v3.4.0 to v3.5.0
we get now following warning if a file is including the header
\Drivers\CMSIS\Device\ST\STM32H7xx\Include\system_stm32h7xx.h
[build] [6/206] Building C object CMakeFiles/STM32_NUCLEO-H753ZI.dir/AZURE_RTOS/App/app_azure_rtos.c.obj
[build] In file included from D:/dev/Prj/Clean_STM32H7_Project__02/AZURE_RTOS/App/app_azure_rtos.c:28:
[build] In file included from D:/dev/Prj/Clean_STM32H7_Project__02/cmake/stm32cubemx/../../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h:124:
[build] In file included from D:/dev/Prj/Clean_STM32H7_Project__02/cmake/stm32cubemx/../../Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h753xx.h:232:
[build] D:/dev/Prj/Clean_STM32H7_Project__02/cmake/stm32cubemx/../../Drivers/CMSIS/Device/ST/STM32H7xx/Include/system_stm32h7xx.h:88:49: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
[build] 88 | extern void ExitRun0Mode(void) __attribute__((optimize("Os")));
[build] | ^~~~~~~~~~~~~~
[build] 1 warning generated. Comparing the versions of system_stm32h7xx.h shows following:

We use the "CMake" and "ST Arm Clang" settings in STM32CubeMX
under "Project Manager / Project / Default Compiler / Linker".
After generating the project we open the folder with VSCode with active STM32CubeIDE Extension.
But clang can not work with the new __attribute__((optimize("Os")) but defines the __GNUC__ macro for compatibility reasons. Therefore we get a warning.
Bet regards Timo
