You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
For a project using PlatformIO, I am trying to configure my platformio.ini file so that I get compiler warnings for my own code in the build_src directory without getting all the warning caused by code from libraries/toolchains.
I would like to have a setup like:
[env]
build_flags=
-w ;Suppress all warnings
build__src_unflags=
-w ;Do not suppress all warnings
build__src_flags=
-Wall ;Show all warnings
-Werror ;Show warnings as errors
Is there a reason build__src_unflags= was not added together with the build__src_flags= ? Could this be added as a new feature?
If the main goal is to apply -Wall -Werror only to your own code, try dropping the global -w and using build_src_flags = -Wall -Werror under [env]. PlatformIO applies these flags only to files in src_dir, so dependencies keep their existing warning settings.
That still leaves any warnings dependencies emit with their default flags. GCC's -w suppresses all warnings, so adding -Wall to the source flags alone won't restore them while -w is still on the command line. pio run -v can show which compile commands actually carry it.
Activity
hariomkhonde108 commentedon Nov 27, 2026
If the main goal is to apply
-Wall -Werroronly to your own code, try dropping the global-wand usingbuild_src_flags = -Wall -Werrorunder[env]. PlatformIO applies these flags only to files insrc_dir, so dependencies keep their existing warning settings.That still leaves any warnings dependencies emit with their default flags. GCC's
-wsuppresses all warnings, so adding-Wallto the source flags alone won't restore them while-wis still on the command line.pio run -vcan show which compile commands actually carry it.