https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97687

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
The "in expansion of macro ‘FOO’" notes (messages 2 and 4) are coming from the
diagnostic finalizer, and so they are effectively printed as part of the first
"error" (message 1) and the "previous declaration of ‘foo’ was here" note
(message 3).

Messages 1 and 3 are both coming from within gcc/c/c-decl.cc: duplicate_decls. 
There is an auto_diagnostic_group.

Perhaps -Wfatal-errors should delay bailing out if an auto_diagnostic_group is
still "in flight", but immediately bail out if it's about to emit another
non-"note" diagnostic?

That might give less surprising behavior, but probably has some nasty
interactions with existing code.

Reply via email to