-2

I know about the '-H' option but that is way too verbose when the precompiled header is NOT used. What I want is the the output -H gives when it DOES use a preocompiled header.

I suspect the answer is "no" but I thought I'd throw a hail mary and ask here.

1 Answers1

0

Read the GCC option summary. Then read about the GCC preprocessor options. Read also about precompiled headers (conceptually, it is just some cache). They have limitations that I explained here.

Why can't you use -H and filter, perhaps by some script using grep or awk, its output? You could also use some -M* option.

Otherwise, you might write your own GCC plugin. It would use the PLUGIN_INCLUDE_FILE event.

My opinion is that writing a plugin for just that information is overkill.

At last, GCC is free software. You are allowed to get its source code and improve it (I am not sure it is worth the effort to understand the internals of GCC for just your purposes). You probably should publish your improvements under GPLv3+ (but that is an ethical or legal or open source licensing question, so off-topic here; be aware of the GCC runtime library exception). You could pay some GCC expert to do the work for you.

Future C++20 (or later) might have modules (see also this and read p1103r0). Of course, you'll need a more recent GCC than the old GCC 7. You could need to wait for GCC 10 or later.

Maybe you should look at other languages, e.g. Rust, Go, or Ocaml.

Basile Starynkevitch
  • 1
  • 16
  • 251
  • 479