C: Fix missing spaces in 'struct' fix-it hints
commit089af25cb61d2ef512038ce2b76f63ab4092328c
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 1 Sep 2016 00:50:54 +0000 (1 00:50 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 1 Sep 2016 00:50:54 +0000 (1 00:50 +0000)
treebeb58f7bd4e805570f23f4411287d644452667ff
parent76e6cb83159730524cf336a1461b5f6fdd0cab54
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
gcc/c/ChangeLog
gcc/c/c-parser.c