On Tue, Aug 30, 2016 at 04:40:57PM +0200, Bernd Schmidt wrote: > On 08/30/2016 04:38 PM, David Malcolm wrote: > > > 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, > > }; > > What happens if there are newlines in between any of the tokens?
It's easy to check for yourself: when the identifier and colon are not on the same line, we print something like w.c: In function ‘main’: w.c:7:1: warning: obsolete use of designated initializer with ‘:’ [-Wpedantic] : ^ = which I don't think is desirable -- giving up on the fix-it hint in such case could be appropriate. I admit I dislike the lack of a space before = in ".bar= 2", but using richloc.add_fixit_replace (colon_loc, " ="); wouldn't work for "foo : 1" I think. Marek