https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97537
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- But the compiler never sees that #include, because it's guarded by the #ifndef The -H option is not a general purpose dependency scanner, it just shows the result of preprocessing. The documentation is clear: "Print the name of each header file used, in addition to other normal activities." It prints the names of the headers USED, i.e. actually included, not a complete graph of all possible paths that could be taken (which could easily lead to cycles). The file header3.h is only used once, because there is only one #include naming it which is actually processed. I think this is invalid, the option is working exactly as intended and as documented.