Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22024

For a given source file, how to see the chain of #include substitutions a macro processor does to find the definition for an identifier?

$
0
0

This is almost a duplicate of C/C++: How to figure out the chain of header files for a given definition?, but the difference is that I do not use Visual Studio, in my case the platform is Unix-based and the tooling available are GCC and Clang toolchains.

Side notes. I think that this feature would require dynamic analysis of code - at least such a tool would need to know which conditional #ifdef-kind of macros to pick - but let's say I am able to provide these on the command line for example (or in a bash script) in the form of -DDEFINITIONS.

This is definitely possible if I deliberately make a mistake in the target include and rely on the compiler reporting an error to me of the form "in file A included form B, from C, .., from Z, there is a blabla-kind of mistake", but of course that would be an overkill if I need to use this feature fairly frequently.

Another side note. I am primarily interested in native Unix tools and those that are close to GCC or Clang toolchain. But if you know any other way, don't hesitate to suggest.


Viewing all articles
Browse latest Browse all 22024

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>