diff options
author | Jason Merrill <jason@redhat.com> | 2021-12-17 05:45:02 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-01-17 11:58:12 -0500 |
commit | d3a57993359c9759990fe8f2aa4088684ed82190 (patch) | |
tree | 82399b3aeabcffc665f0808ade49811306a04557 /gcc/diagnostic.h | |
parent | 450c85b81f4dd67bf6211d307afdc0f3c07ef44f (diff) | |
download | gcc-upstream-d3a57993359c9759990fe8f2aa4088684ed82190.tar.gz |
diagnostic: avoid repeating include path
When a sequence of diagnostic messages bounces back and forth repeatedly
between two includes, as with
#include <map>
std::map<const char*, const char*> m ("123", "456");
The output is quite a bit longer than necessary because we dump the include
path each time it changes. I'd think we could print the include path once
for each header file, and then expect that the user can look earlier in the
output if they're wondering.
gcc/ChangeLog:
* diagnostic.h (struct diagnostic_context): Add includes_seen.
* diagnostic.c (diagnostic_initialize): Initialize it.
(diagnostic_finish): Clean it up.
(includes_seen): New function.
(diagnostic_report_current_module): Use it.
gcc/testsuite/ChangeLog:
* c-c++-common/cpp/line-2.c: Only expect includes once.
* c-c++-common/cpp/line-3.c: Likewise.
Diffstat (limited to 'gcc/diagnostic.h')
-rw-r--r-- | gcc/diagnostic.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 6739028a931..ccaa33b5817 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -387,6 +387,10 @@ struct diagnostic_context the BLOCK_SUPERCONTEXT() chain hanging off the LOCATION_BLOCK() of a diagnostic's location. */ void (*set_locations_cb)(diagnostic_context *, diagnostic_info *); + + /* Include files that diagnostic_report_current_module has already listed the + include path for. */ + hash_set<location_t, false, location_hash> *includes_seen; }; static inline void |