Re: minor compiler warning on OpenBSD

Lists: pgsql-hackers
From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: minor compiler warning on OpenBSD
Date: 2007-07-11 15:42:00
Message-ID: 4694FA48.600@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-11 15:59:13
Message-ID: 26468.1184169553@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)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


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-11 21:03:19
Message-ID: 46954597.6010105@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-11 22:26:46
Message-ID: 20070711222646.GF5267@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stefan Kaltenbrunner wrote:
> Tom Lane wrote:
> > Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)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.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-11 23:18:17
Message-ID: 4522.1184195897@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)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


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-12 07:06:53
Message-ID: 4695D30D.2050203@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)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


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-16 15:41:49
Message-ID: 20070716154149.GA29005@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)jabber(dot)org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-16 16:02:18
Message-ID: 15163.1184601738@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes <meskes(at)postgresql(dot)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


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-16 16:09:47
Message-ID: 469B984B.8050701@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Michael Meskes <meskes(at)postgresql(dot)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&dt=2007-07-16%20053004&stg=make

Stefan


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-16 16:17:56
Message-ID: 15453.1184602676@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)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


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-17 07:55:30
Message-ID: 20070717075530.GA28049@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)jabber(dot)org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Meskes <meskes(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor compiler warning on OpenBSD
Date: 2007-07-17 07:56:10
Message-ID: 20070717075610.GB28049@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)jabber(dot)org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!