How to list defined symbols?

Just getting started with platformIO and loving it so far. I use CLI and eclipse, with multiple boards.

I’d like to be able to list all the #define symbols found in my code and the various libraries both to find and use them and avoid conflicts. With GCC I can run something like gcc -E -dM to print all defined symbols.

Is there a way to either pass arbitrary options to the platformIO compiler cmdline or specifically ask platformIO to explore the libraries?

A simple grep -r '#define' . doesn’t quite work – it will find all the defines but many are conditional based on other #ifdef statements or in files in a library that are not included in my project.

Suggestions? Workarounds?

PlatformIO Build System is based on SCons tool. SCons doesn’t provide this information because it is buid system (not compiler). Nevertheless, you can resolve it with extra_script.

The full process should look like:

  1. Create extra script for PlatformIO Build System
  2. Get a list with build files
  3. Run gcc -fpreprocessed -E -dM on each file
  4. Parse defines

Here is explanation how to list all files that are going to be built https://bitbucket.org/scons/scons/wiki/FindTargetSources
This approach requires Python and SCons skills. I even don’t know how to explain in a few words how to resolve it.

SCons is build tool/framework (Python-based alternative to make/cmake). We created own cross-platform super-fast Build System with automatic Library Dependecy Finder for development platforms . Here is source code and development platforms.