0

For the moment, my C codebases compile relatively quickly. However, I would like to utilise an informed approach to reducing the number of times a given header is re-processed.

I guess that being able to see reference counts would help me to do so. How would I do that?

Engineer
  • 8,529
  • 7
  • 65
  • 105

1 Answers1

2

Both CLang and GCC support the -H option. It will dump into the console each header file included. Then, you can easily read these lines and analyze them to detect compiler bottlenecks.

From man gcc:

-H Print the name of each header file used, in addition to other normal activities. Each name is indented to show how deep in the #include stack it is.

Precompiled header files are also printed, even if they are found to be invalid; an invalid precompiled header file is printed with ...x and a valid one with ...!.

Community
  • 1
  • 1
rodrigo
  • 94,151
  • 12
  • 143
  • 190