Skip to content

Feature suggestion: build_src_unflags #5547

Open

Description

@Woutvstk

Feature suggestion: build_src_unflags

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?

Thanks in advance!
Greetings
Wout

Activity

  1. hariomkhonde108 commented on Nov 27, 2026

    @hariomkhonde108

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions