Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Jeff Law
On 10/16/19 9:43 AM, Martin Sebor wrote: > On 10/16/19 9:11 AM, Richard Sandiford wrote: >> Sorry for the slow reply. >> >> Bernd Edlinger writes: >>> Hi, >>> >>> this is probably on the border to obvious. >>> >>> The REGEXP_xxx macros in genautomata are invoked >>> recursively, and the local

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Eric Gallager
On 10/16/19, Jakub Jelinek wrote: > On Wed, Oct 16, 2019 at 10:03:51AM -0600, Martin Sebor wrote: >> > The counter example would be: >> > #define F(x) \ >> >__extension__ (({ __typeof__ (x) _x = x; _x < 0 ? -_x : _x; })) >> > #define G(x) \ >> >__extension__ (({ __typeof__ (x) _x = x;

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Segher Boessenkool
On Wed, Oct 16, 2019 at 10:03:51AM -0600, Martin Sebor wrote: > PS The counterexample nicely illustrates why -Wself-init should > be in -Wall like in Clang or MSVC, or at least in -Wextra like in > ICC. Let me take it as a reminder to submit a patch for GCC 10. c-family/c-gimplify.c says:

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Jakub Jelinek
On Wed, Oct 16, 2019 at 10:03:51AM -0600, Martin Sebor wrote: > > The counter example would be: > > #define F(x) \ > >__extension__ (({ __typeof__ (x) _x = x; _x < 0 ? -_x : _x; })) > > #define G(x) \ > >__extension__ (({ __typeof__ (x) _x = x; F(_x); })) > > where a -Wshadow diagnostics

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Joseph Myers
On Wed, 16 Oct 2019, Jakub Jelinek wrote: > The counter example would be: > #define F(x) \ > __extension__ (({ __typeof__ (x) _x = x; _x < 0 ? -_x : _x; })) > #define G(x) \ > __extension__ (({ __typeof__ (x) _x = x; F(_x); })) > where a -Wshadow diagnostics could point the author at a

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Martin Sebor
On 10/16/19 9:50 AM, Jakub Jelinek wrote: On Wed, Oct 16, 2019 at 09:43:49AM -0600, Martin Sebor wrote: Should the warning trigger when the shadowing name results from macro expansion? The author of a macro can't (in general) know what context it's going to be used, and when different macros

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Jakub Jelinek
On Wed, Oct 16, 2019 at 09:43:49AM -0600, Martin Sebor wrote: > Should the warning trigger when the shadowing name results from > macro expansion? The author of a macro can't (in general) know > what context it's going to be used, and when different macros > come from two different third party

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Martin Sebor
On 10/16/19 9:11 AM, Richard Sandiford wrote: Sorry for the slow reply. Bernd Edlinger writes: Hi, this is probably on the border to obvious. The REGEXP_xxx macros in genautomata are invoked recursively, and the local values are all named _regexp and shadow each other. Fixed by using

Re: [PATCH] Fix -Wshadow=local warnings in genautomata.c

2019-10-16 Thread Richard Sandiford
Sorry for the slow reply. Bernd Edlinger writes: > Hi, > > this is probably on the border to obvious. > > The REGEXP_xxx macros in genautomata are invoked > recursively, and the local values are all named _regexp > and shadow each other. > > > Fixed by using different names _regexp1..6 for each