+2017-04-25 David Malcolm <dmalcolm@redhat.com>
+
+ * c-parser.c (c_parser_struct_or_union_specifier): Add fix-it
+ hint for removing extra semicolon.
+
2017-04-21 Jakub Jelinek <jakub@redhat.com>
PR c/80468
/* Parse any stray semicolon. */
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
- pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic,
- "extra semicolon in struct or union specified");
+ location_t semicolon_loc
+ = c_parser_peek_token (parser)->location;
+ gcc_rich_location richloc (semicolon_loc);
+ richloc.add_fixit_remove ();
+ pedwarn_at_rich_loc
+ (&richloc, OPT_Wpedantic,
+ "extra semicolon in struct or union specified");
c_parser_consume_token (parser);
continue;
}
+2017-04-25 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/semicolon-fixits.c: New test case.
+
2017-04-25 David Malcolm <dmalcolm@redhat.com>
* g++.dg/lookup/missing-std-include.C: New test file.
--- /dev/null
+/* { dg-options "-fdiagnostics-show-caret -Wpedantic" } */
+
+/* Struct with extra semicolon. */
+struct s1 { int i;; }; /* { dg-warning "19: extra semicolon in struct or union specified" } */
+/* { dg-begin-multiline-output "" }
+ struct s1 { int i;; };
+ ^
+ -
+ { dg-end-multiline-output "" } */
+
+/* Union with extra semicolon. */
+union u1 { int i;; }; /* { dg-warning "18: extra semicolon in struct or union specified" } */
+/* { dg-begin-multiline-output "" }
+ union u1 { int i;; };
+ ^
+ -
+ { dg-end-multiline-output "" } */