aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-09-01 00:50:54 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-09-01 00:50:54 +0000
commit089af25cb61d2ef512038ce2b76f63ab4092328c (patch)
treebeb58f7bd4e805570f23f4411287d644452667ff /gcc/c
parent76e6cb83159730524cf336a1461b5f6fdd0cab54 (diff)
downloadgcc-089af25cb61d2ef512038ce2b76f63ab4092328c.zip
gcc-089af25cb61d2ef512038ce2b76f63ab4092328c.tar.gz
gcc-089af25cb61d2ef512038ce2b76f63ab4092328c.tar.bz2
C: Fix missing spaces in 'struct' fix-it hints
In r237714 I added fix-it hints to the C frontend for missing "struct" keywords e.g.: spellcheck-typenames.c:69:1: error: unknown type name ‘foo_t’; use ‘struct’ keyword to refer to the type foo_t *foo_ptr; ^~~~~ struct However when using the (not yet in trunk) option -fdiagnostics-generate-patch, the generated patch is nonsensical: -foo_t *foo_ptr; +structfoo_t *foo_ptr; Fix the fix-its by adding a trailing space to each one, giving: -foo_t *foo_ptr; +struct foo_t *foo_ptr; gcc/c/ChangeLog: * c-parser.c (c_parser_declaration_or_fndef): Add trailing space to the insertion fixits for "struct", "union", and "enum". From-SVN: r239912
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-parser.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 2d99155..3ac6648 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-31 David Malcolm <dmalcolm@redhat.com>
+
+ * c-parser.c (c_parser_declaration_or_fndef): Add trailing space
+ to the insertion fixits for "struct", "union", and "enum".
+
2016-08-30 David Malcolm <dmalcolm@redhat.com>
* c-decl.c (implicit_decl_warning): Use add_fixit_replace
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index c245e70..0581899 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -1685,7 +1685,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
if (tag_exists_p (RECORD_TYPE, name))
{
/* This is not C++ with its implicit typedef. */
- richloc.add_fixit_insert ("struct");
+ richloc.add_fixit_insert ("struct ");
error_at_rich_loc (&richloc,
"unknown type name %qE;"
" use %<struct%> keyword to refer to the type",
@@ -1693,7 +1693,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
}
else if (tag_exists_p (UNION_TYPE, name))
{
- richloc.add_fixit_insert ("union");
+ richloc.add_fixit_insert ("union ");
error_at_rich_loc (&richloc,
"unknown type name %qE;"
" use %<union%> keyword to refer to the type",
@@ -1701,7 +1701,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
}
else if (tag_exists_p (ENUMERAL_TYPE, name))
{
- richloc.add_fixit_insert ("enum");
+ richloc.add_fixit_insert ("enum ");
error_at_rich_loc (&richloc,
"unknown type name %qE;"
" use %<enum%> keyword to refer to the type",