On Thu, 2016-09-15 at 11:27 -0600, Jeff Law wrote:
> On 08/30/2016 08:38 AM, David Malcolm wrote:
> > This patch adds fix-it hints to our warning for old-style structure
> > member designators, showing how to modernize them to C99 form.
> > 
> > For example:
> > 
> > modernize-named-inits.c:19:5: warning: obsolete use of designated
> > initializer with ‘:’ [-Wpedantic]
> >   foo: 1,
> >      ^
> >   .  =
> > 
> > In conjunction with the not-yet-in-trunk -fdiagnostics-generate
> > -patch,
> > this can generate patches like this:
> > 
> > --- modernize-named-inits.c
> > +++ modernize-named-inits.c
> > @@ -16,7 +16,7 @@
> >  /* Old-style named initializers.  */
> > 
> >  struct foo old_style_f = {
> > - foo: 1,
> > - bar: 2,
> > + .foo= 1,
> > + .bar= 2,
> >  };
> > 
> > Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu.
> > 
> > OK for trunk?
> > 
> > gcc/c/ChangeLog:
> >     * c-parser.c (c_parser_initelt): Provide fix-it hints for
> >     modernizing old-style structure member designator to C99 style.
> > 
> > gcc/testsuite/ChangeLog:
> >     * gcc.dg/modernize-named-inits.c: New test case.
> OK.
> jeff

Thanks.  Marek expressed some concern about how the fix-it hint is
printed:
  https://gcc.gnu.org/ml/gcc-patches/2016-08/msg02112.html
I've been looking at rewriting how fixits get printed, to print the
affected range of the affected lines, which would address his concern,
but this work isn't finished yet.

Should that work be a blocker for committing this modernize-named
-inits.c fix-it patch, or is the patch good enough as-is?
(for example, -fdiagnostics-generate-patch does a good job on it as
-is).

Dave

Reply via email to