build_unflags
removes flags specified in build_flags
(can't remove and replace -D with new value)
#4309
Labels
Milestone
What kind of issue is this?
If you’ve found a bug, please provide an information below.
Configuration
Operating system: Ubuntu 22.04 LTS (Linux 5.15.0)
PlatformIO Version (
platformio --version
): PlatformIO Core, version 6.0.2Description of problem
I wanted to remove and replace a platform build flag with my own, so I put the following in
platformio.ini
:However, while this did successfully remove the platform
-DUSB_PRODUCT
, it also removed my replacement, leaving me with no such flag (as visible inpio run-v
), and the platform code used a default value instead. As far as I can tell this is because, first, unflags are run through a parser and considered to match if the flag-part (-DUSB_PRODUCT
) but not necessarily the value-part (\"Seeeduino XIAO\"
) matches; second,build_unflags
will apparently remove flags that were added withbuild_flags
.Changing either one of these two things would allow this to work. (Removing and replacing
-D
type flags has to be a common desire?) Note, I was able to work around this specific case with the following:However, not every flag one might wish to remove and replace has a
-U
type antiflag.Steps to Reproduce
-DFOO=bar
tobuild_unflags
-DFOO=bat
tobuild_flags
pio run -v
Actual Results
No
-DFOO=...
is includedExpected Results
-DFOO=bat
is includedThe text was updated successfully, but these errors were encountered: