On Sun, Jul 23, 2017 at 11:22:14PM +0200, Volker Reichelt wrote: [...] Not sure if the warning is too useful, but in any case...
> + /* Emit warning. */ > + gcc_rich_location richloc (token->location); > + richloc.add_fixit_remove (); > + if (colon_token->type == CPP_COLON) > + richloc.add_fixit_remove (colon_token->location); > + > + switch (message_id) > + { > + case 1: > + warning_at_rich_loc (&richloc, OPT_Waccess_specifiers_, > + "redundant %qE access-specifier", > + token->u.value); > + inform (next_token->location, "directly followed by another one here"); > + break; > + > + case 2: > + warning_at_rich_loc (&richloc, OPT_Waccess_specifiers_, > + "duplicate %qE access-specifier", > + token->u.value); > + inform (current_access_specifier_loc, > + "same access-specifier was previously given here"); > + break; ...you should only call inform if warning_at_rich_loc returned true. Marek