Re: compiler warnings with GCC 4.5

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: compiler warnings with GCC 4.5
Date: 2010-01-17 16:19:38
Message-ID: 1263745178.11833.10.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Only these few:

read.c: In function ‘nodeRead’:
read.c:370:3: warning: case value ‘1000001’ not in enumerated type
‘NodeTag’
read.c:300:3: warning: case value ‘1000002’ not in enumerated type
‘NodeTag’
read.c:294:3: warning: case value ‘1000003’ not in enumerated type
‘NodeTag’
read.c:374:3: warning: case value ‘1000004’ not in enumerated type
‘NodeTag’

This can be fixed by changing

switch (type)

to

switch ((int) type)

preproc.y: In function ‘base_yyparse’:
preproc.y:8043:19: warning: operation on ‘yyval.str’ may be undefined

The code in question looks like

| SETOF SimpleTypename opt_array_bounds
{ $$ = $$ = cat_str(3, make_str("setof"), $2, $3.str); }
^^^^^^^

It is converted from the main grammar, so it looks like a bug in the
conversion routine.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Re: compiler warnings with GCC 4.5
Date: 2010-01-17 16:32:50
Message-ID: 21634.1263745970@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> read.c: In function nodeRead:
> read.c:370:3: warning: case value 1000001 not in enumerated type
> NodeTag

> This can be fixed by changing
> switch (type)
> to
> switch ((int) type)

No objection from here. We don't attempt to cover all possible NodeTags
in that switch anyway, so I don't see that we're losing any error
detection capability by adding the cast.

> preproc.y: In function base_yyparse:
> preproc.y:8043:19: warning: operation on yyval.str may be undefined

> The code in question looks like

> | SETOF SimpleTypename opt_array_bounds
> { $$ = $$ = cat_str(3, make_str("setof"), $2, $3.str); }
> ^^^^^^^

> It is converted from the main grammar, so it looks like a bug in the
> conversion routine.

The double assignment looks inefficient, but I bet what it's really unhappy
about is that one of the cat_str arguments has a .str suffix and the
other doesn't --- why is that?

regards, tom lane