https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94371
Bug ID: 94371 Summary: Macro-printing within diagnostic paths can be very verbose. Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- The default -fdiagnostics-path-format=inline-events prints each macro expansion for every event in the path that's from a macro expansion. This can be very verbose; consider e.g. the krb5 example here: https://dmalcolm.fedorapeople.org/gcc/2020-02-28/recvauth.c.html where there's a: #define krb5_xfree(val) free((char *)(val)) The expansion is printed many times: * for the primary location of each of the two diagnostics * for events 9, 10, and 11 of the first diagnostic * for events 9, 10, 12 and 13 of the second diagnostic i.e. it's printed 4 times for the first diagnostic, and 5 times for the second diagnostic. Ideas for making it less verbose: * only print macro expansions with paths once per path (so in the example it would print the expansions per primary loc, and once per path) * only print macro expansions within paths once per diagnostic_group (and not printing it if the primary location showed it, so in the example it would only print it per primary loc) * only once within paths per diagnostic_context (so it the example it would only print it once) * or some other kind of consolidation However, this is a simple macro; it's not clear what we should do with more complicated macros. Perhaps do it per token of the macro, so that if we're exploring control flow within a macro, we show that.