aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2017-04-25 14:03:55 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2017-04-25 14:03:55 +0000
commit1c4ea66f24bc3801448d5c88847fc97d4e2767ee (patch)
tree1e26f9c2f74735c269776ad691d99a69ba534766 /gcc/c/c-parser.c
parente0666fc62f436b35e9ad3b806cb081d95f2f66c6 (diff)
downloadgcc-1c4ea66f24bc3801448d5c88847fc97d4e2767ee.zip
gcc-1c4ea66f24bc3801448d5c88847fc97d4e2767ee.tar.gz
gcc-1c4ea66f24bc3801448d5c88847fc97d4e2767ee.tar.bz2
C: fix-it hint for removing stray semicolons
gcc/c/ChangeLog: * c-parser.c (c_parser_struct_or_union_specifier): Add fix-it hint for removing extra semicolon. gcc/testsuite/ChangeLog: * gcc.dg/semicolon-fixits.c: New test case. From-SVN: r247243
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 988369e..9398652 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -2948,8 +2948,13 @@ c_parser_struct_or_union_specifier (c_parser *parser)
/* 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;
}