+2017-04-25 David Malcolm <dmalcolm@redhat.com>
+
+ * parser.c (cp_parser_member_declaration): Add fix-it hint
+ for removing stray semicolons.
+
2017-04-25 David Malcolm <dmalcolm@redhat.com>
* name-lookup.c (get_std_name_hint): New function.
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
if (!in_system_header_at (token->location))
- pedwarn (token->location, OPT_Wpedantic, "extra %<;%>");
+ {
+ gcc_rich_location richloc (token->location);
+ richloc.add_fixit_remove ();
+ pedwarn_at_rich_loc (&richloc, OPT_Wpedantic, "extra %<;%>");
+ }
}
else
{
+2017-04-25 David Malcolm <dmalcolm@redhat.com>
+
+ * g++.dg/semicolon-fixits.C: New test case.
+
2017-04-25 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/semicolon-fixits.c: New test case.
--- /dev/null
+/* { dg-options "-fdiagnostics-show-caret -Wpedantic" } */
+
+/* Struct with extra semicolon. */
+struct s1 { int i;; }; /* { dg-warning "19: extra .;." } */
+/* { dg-begin-multiline-output "" }
+ struct s1 { int i;; };
+ ^
+ -
+ { dg-end-multiline-output "" } */
+
+/* Union with extra semicolon. */
+union u1 { int i;; }; /* { dg-warning "18: extra .;." } */
+/* { dg-begin-multiline-output "" }
+ union u1 { int i;; };
+ ^
+ -
+ { dg-end-multiline-output "" } */