minor compiler warning on OpenBSD

Started by Stefan Kaltenbrunnerover 18 years ago12 messages
#1Stefan Kaltenbrunner
stefan@kaltenbrunner.cc

while looking at some other stuff I noticed that we have the following
compiler warning on OpenBSD 4.0/amd64 with the OS supplied compiler:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wendif-labels -fno-strict-aliasing -DFRONTEND
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/include/kerberosV/ -c -o initdb.o initdb.c
initdb.c: In function `locale_date_order':
initdb.c:2187: warning: `%x' yields only last 2 digits of year in some
locales

$ gcc -v
Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd4.0/3.3.5/specs
Configured with:
Thread model: single
gcc version 3.3.5 (propolice)

Stefan

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stefan Kaltenbrunner (#1)
Re: minor compiler warning on OpenBSD

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

while looking at some other stuff I noticed that we have the following
compiler warning on OpenBSD 4.0/amd64 with the OS supplied compiler:
initdb.c:2187: warning: `%x' yields only last 2 digits of year in some
locales

Yeah, mine complains about that too. Peter's response was "get a newer
compiler" --- apparently the gcc folks thought better of this warning
after the Y2K panic subsided.

regards, tom lane

#3Stefan Kaltenbrunner
stefan@kaltenbrunner.cc
In reply to: Tom Lane (#2)
Re: minor compiler warning on OpenBSD

Tom Lane wrote:

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

while looking at some other stuff I noticed that we have the following
compiler warning on OpenBSD 4.0/amd64 with the OS supplied compiler:
initdb.c:2187: warning: `%x' yields only last 2 digits of year in some
locales

Yeah, mine complains about that too. Peter's response was "get a newer
compiler" --- apparently the gcc folks thought better of this warning
after the Y2K panic subsided.

hmm ok - but at least on openbsd we will have to accept that warning for
a few years to go (4.1 shipped with 3.3.5 and it seems that the
upcoming 4.2 is not getting an upgraded compiler either)

Stefan

#4Alvaro Herrera
alvherre@commandprompt.com
In reply to: Stefan Kaltenbrunner (#3)
Re: minor compiler warning on OpenBSD

Stefan Kaltenbrunner wrote:

Tom Lane wrote:

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

while looking at some other stuff I noticed that we have the following
compiler warning on OpenBSD 4.0/amd64 with the OS supplied compiler:
initdb.c:2187: warning: `%x' yields only last 2 digits of year in some
locales

Yeah, mine complains about that too. Peter's response was "get a newer
compiler" --- apparently the gcc folks thought better of this warning
after the Y2K panic subsided.

hmm ok - but at least on openbsd we will have to accept that warning for
a few years to go (4.1 shipped with 3.3.5 and it seems that the
upcoming 4.2 is not getting an upgraded compiler either)

My local manpage for strftime says that we can get around this warning
by overloading it with something like

size_t
my_strftime(char *s, size_t max, const char *fmt,
const struct tm *tm)
{
return strftime(s, max, fmt, tm);
}

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#4)
Re: minor compiler warning on OpenBSD

Alvaro Herrera <alvherre@commandprompt.com> writes:

My local manpage for strftime says that we can get around this warning
by overloading it with something like

size_t
my_strftime(char *s, size_t max, const char *fmt,
const struct tm *tm)
{
return strftime(s, max, fmt, tm);
}

Hey, that works nicely. On my version of gcc, it suppresses the warning
even if my_strftime is marked "static inline", which should mean that
there's no runtime penalty.

I've committed the patch to HEAD --- Stefan, would you check if it
silences your version of gcc?

Now if we could only get rid of those flex-induced warnings in ecpg...

regards, tom lane

#6Stefan Kaltenbrunner
stefan@kaltenbrunner.cc
In reply to: Tom Lane (#5)
Re: minor compiler warning on OpenBSD

Tom Lane wrote:

Alvaro Herrera <alvherre@commandprompt.com> writes:

My local manpage for strftime says that we can get around this warning
by overloading it with something like

size_t
my_strftime(char *s, size_t max, const char *fmt,
const struct tm *tm)
{
return strftime(s, max, fmt, tm);
}

Hey, that works nicely. On my version of gcc, it suppresses the warning
even if my_strftime is marked "static inline", which should mean that
there's no runtime penalty.

I've committed the patch to HEAD --- Stefan, would you check if it
silences your version of gcc?

yeah that patch fixes the warning for me too - thanks!

Stefan

#7Michael Meskes
meskes@postgresql.org
In reply to: Tom Lane (#5)
Re: minor compiler warning on OpenBSD

On Wed, Jul 11, 2007 at 07:18:17PM -0400, Tom Lane wrote:

Now if we could only get rid of those flex-induced warnings in ecpg...

Don't you get the same in the backend's parser code? I surely do.

It seems these are only missing prototypes. How about adding an include
file with those prototypes?

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Meskes (#7)
Re: minor compiler warning on OpenBSD

Michael Meskes <meskes@postgresql.org> writes:

On Wed, Jul 11, 2007 at 07:18:17PM -0400, Tom Lane wrote:

Now if we could only get rid of those flex-induced warnings in ecpg...

Don't you get the same in the backend's parser code? I surely do.

No, ecpg is the only one producing warnings for me. What flex version
do you use?

It seems these are only missing prototypes. How about adding an include
file with those prototypes?

What I get with flex 2.5.4 is

pgc.c: In function `base_yylex':
pgc.c:1564: warning: label `find_rule' defined but not used
preproc.y: At top level:
pgc.c:3818: warning: `yy_flex_realloc' defined but not used

neither of which seem fixable that way.

regards, tom lane

#9Stefan Kaltenbrunner
stefan@kaltenbrunner.cc
In reply to: Tom Lane (#8)
Re: minor compiler warning on OpenBSD

Tom Lane wrote:

Michael Meskes <meskes@postgresql.org> writes:

On Wed, Jul 11, 2007 at 07:18:17PM -0400, Tom Lane wrote:

Now if we could only get rid of those flex-induced warnings in ecpg...

Don't you get the same in the backend's parser code? I surely do.

No, ecpg is the only one producing warnings for me. What flex version
do you use?

It seems these are only missing prototypes. How about adding an include
file with those prototypes?

What I get with flex 2.5.4 is

pgc.c: In function `base_yylex':
pgc.c:1564: warning: label `find_rule' defined but not used
preproc.y: At top level:
pgc.c:3818: warning: `yy_flex_realloc' defined but not used

neither of which seem fixable that way.

I think Michael is refering to:

In file included from bootparse.y:380:
bootscanner.c:1855: warning: no previous prototype for
‘boot_yyget_lineno’
bootscanner.c:1864: warning: no previous prototype for ‘boot_yyget_in’
bootscanner.c:1872: warning: no previous prototype for ‘boot_yyget_out’
bootscanner.c:1880: warning: no previous prototype for ‘boot_yyget_leng’
bootscanner.c:1889: warning: no previous prototype for ‘boot_yyget_text’
bootscanner.c:1898: warning: no previous prototype for
‘boot_yyset_lineno’
bootscanner.c:1910: warning: no previous prototype for ‘boot_yyset_in’
bootscanner.c:1915: warning: no previous prototype for ‘boot_yyset_out’
bootscanner.c:1920: warning: no previous prototype for
‘boot_yyget_debug’
bootscanner.c:1925: warning: no previous prototype for
‘boot_yyset_debug’
bootscanner.c:1959: warning: no previous prototype for
‘boot_yylex_destroy’

In file included from gram.y:9663:
scan.c:7050: warning: no previous prototype for ‘base_yyget_lineno’
scan.c:7059: warning: no previous prototype for ‘base_yyget_in’
scan.c:7067: warning: no previous prototype for ‘base_yyget_out’
scan.c:7075: warning: no previous prototype for ‘base_yyget_leng’
scan.c:7084: warning: no previous prototype for ‘base_yyget_text’
scan.c:7093: warning: no previous prototype for ‘base_yyset_lineno’
scan.c:7105: warning: no previous prototype for ‘base_yyset_in’
scan.c:7110: warning: no previous prototype for ‘base_yyset_out’
scan.c:7115: warning: no previous prototype for ‘base_yyget_debug’
scan.c:7120: warning: no previous prototype for ‘base_yyset_debug’
scan.c:7154: warning: no previous prototype for ‘base_yylex_destroy’

...

http://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=Shad&amp;dt=2007-07-16%20053004&amp;stg=make

Stefan

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stefan Kaltenbrunner (#9)
Re: minor compiler warning on OpenBSD

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

Tom Lane wrote:

What I get with flex 2.5.4 is

pgc.c: In function `base_yylex':
pgc.c:1564: warning: label `find_rule' defined but not used
preproc.y: At top level:
pgc.c:3818: warning: `yy_flex_realloc' defined but not used

neither of which seem fixable that way.

I think Michael is refering to:

In file included from bootparse.y:380:
bootscanner.c:1855: warning: no previous prototype for=20
=E2=80=98boot_yyget_lineno=E2=80=99
bootscanner.c:1864: warning: no previous prototype for =E2=80=98boot_yyge=
t_in=E2=80=99
bootscanner.c:1872: warning: no previous prototype for =E2=80=98boot_yyge=
t_out=E2=80=99
bootscanner.c:1880: warning: no previous prototype for =E2=80=98boot_yyge=
t_leng=E2=80=99
bootscanner.c:1889: warning: no previous prototype for =E2=80=98boot_yyge=
t_text=E2=80=99

[ shrug... ] Those are flex bugs.

regards, tom lane

#11Michael Meskes
meskes@postgresql.org
In reply to: Tom Lane (#8)
Re: minor compiler warning on OpenBSD

On Mon, Jul 16, 2007 at 12:02:18PM -0400, Tom Lane wrote:

No, ecpg is the only one producing warnings for me. What flex version
do you use?

2.5.33

What I get with flex 2.5.4 is

pgc.c: In function `base_yylex':
pgc.c:1564: warning: label `find_rule' defined but not used
preproc.y: At top level:
pgc.c:3818: warning: `yy_flex_realloc' defined but not used

These don't appear with my flex version.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

#12Michael Meskes
meskes@postgresql.org
In reply to: Stefan Kaltenbrunner (#9)
Re: minor compiler warning on OpenBSD

On Mon, Jul 16, 2007 at 06:09:47PM +0200, Stefan Kaltenbrunner wrote:

I think Michael is refering to:

In file included from bootparse.y:380:
bootscanner.c:1855: warning: no previous prototype for
‘boot_yyget_lineno’
...

Right, I was talking about these messages.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!