Re: error: jump skips variable initialization

2018-06-25 Thread Jim Meyering
On Mon, Jun 25, 2018 at 12:07 PM, Bruno Haible wrote: ... > OK, done as follows: > > 2018-06-25 Bruno Haible > > manywarnings: Don't enable -Wjump-misses-init warnings by default. > * build-aux/gcc-warning.spec: Add -Wjump-misses-init. > * m4/manywarnings.m4 (gl_MANYWARN

Re: error: jump skips variable initialization

2018-06-25 Thread Bruno Haible
Paul Eggert wrote: > the warning is not emitted if the program simply does this instead: > > int x; x = 10; > Indeed: While === extern void bar (int); int foo (int a) { if (a == 1) goto one; int b = 4; bar (b); one: return a; }

Re: error: jump skips variable initialization

2018-06-25 Thread Paul Eggert
Bruno Haible wrote: Can someone answer this? I expect the warning is there because of style reasons, not correctness reasons. That is, although it's natural when seeing this line: int x = 10; to assume that X must always be initialized, this assumption is incorrect if a goto jumps over

Re: error: jump skips variable initialization

2018-06-25 Thread Tim Rühsen
On 06/25/2018 02:00 AM, Bruno Haible wrote: > Hi Jim, Paul, > >> parse-datetime.y: In function 'parse_datetime2': >> parse-datetime.y:1791:19: error: jump skips variable initialization \ >> [-Werror=jump-misses-init] > > First this occurred in af_alg.c with pretty standard Linux kernel style >

Re: error: jump skips variable initialization

2018-06-24 Thread Jim Meyering
On Sun, Jun 24, 2018 at 5:00 PM, Bruno Haible wrote: > Hi Jim, Paul, > >> parse-datetime.y: In function 'parse_datetime2': >> parse-datetime.y:1791:19: error: jump skips variable initialization \ >> [-Werror=jump-misses-init] Hi Bruno, Didn't this warning or one very much like it catch real bu

Re: error: jump skips variable initialization

2018-06-24 Thread Bruno Haible
Hi Jim, Paul, > parse-datetime.y: In function 'parse_datetime2': > parse-datetime.y:1791:19: error: jump skips variable initialization \ > [-Werror=jump-misses-init] First this occurred in af_alg.c with pretty standard Linux kernel style with gotos. [1] Now here. What is the point of this warn