https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118392
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is auto_diagnostic_group but it looks like it is not working.
if (hidden_p)
{
auto_diagnostic_group d;
pedwarn (DECL_SOURCE_LOCATION (decl), 0,
"%qD has not been declared within %qD", decl, scope);
inform (DECL_SOURCE_LOCATION (found),
"only here as a %<friend%>");
}
