Fix an issue when `-U in build_flags does not remove macro previously defined via -D` flag // Resolve #2508

This commit is contained in:
Ivan Kravets
2019-05-24 14:57:59 +03:00
parent e6d1805f0b
commit b38c57bcf9
2 changed files with 3 additions and 0 deletions

View File

@ -33,6 +33,7 @@ PlatformIO 4.0
* **Miscellaneous**
- Deprecated ``--only-check`` PlatformIO Core CLI option for "update" sub-commands, please use ``--dry-run`` instead
- Fixed an issue when ``-U`` in ``build_flags`` does not remove macro previously defined via ``-D`` flag (`issue #2508 <https://github.com/platformio/platformio-core/issues/2508>`_)
PlatformIO 3.0
--------------

View File

@ -198,6 +198,8 @@ def ProcessFlags(env, flags): # pylint: disable=too-many-branches
if undefines:
for undef in undefines:
env['CCFLAGS'].remove(undef)
if undef[2:] in env['CPPDEFINES']:
env['CPPDEFINES'].remove(undef[2:])
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))