extern + static issue in datetime.c

Started by Zeugswetter Andreas SB SDover 24 years ago4 messageshackers
Jump to latest
#1Zeugswetter Andreas SB SD
ZeugswetterA@spardat.at

Current sources don't compile on AIX with xlc compiler because of the
combined (and inconsistent ? or compiler bug) use of extern and static
for the datetktbl in datetime.c.

header unconditionally has:
extern datetkn datetktbl[];

source has:
static datetkn datetktbl[] = {

The usual approach would be to avoid that line in the header if included

from datetime.c, but I think it would be better to use a const in this
case.

I think this is a general compatibility problem, and thus needs to be
solved.

Andreas

#2Zeugswetter Andreas SB SD
ZeugswetterA@spardat.at
In reply to: Zeugswetter Andreas SB SD (#1)
RE: extern + static issue in datetime.c

I wrote:

Current sources don't compile on AIX with xlc compiler because of the
combined (and inconsistent ? or compiler bug) use of extern
and static
for the datetktbl in datetime.c.

header unconditionally has:
extern datetkn datetktbl[];

source has:
static datetkn datetktbl[] = {

The usual approach would be to avoid that line in the header
if included

from datetime.c, but I think it would be better to use a const in this
case.

I think this is a general compatibility problem, and thus needs to be
solved.

Attached is a patch that might be considered (remove static for these
globals).

Thanks
Andreas

Attachments:

datetime.patchapplication/octet-stream; name=datetime.patchDownload+12-12
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Zeugswetter Andreas SB SD (#1)
Re: extern + static issue in datetime.c

"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:

Current sources don't compile on AIX with xlc compiler because of the
combined (and inconsistent ? or compiler bug) use of extern and static
for the datetktbl in datetime.c.

Fixed. A pass with HP's compiler also showed up a static-vs-not-static
conflict in network.c.

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Zeugswetter Andreas SB SD (#2)
Re: extern + static issue in datetime.c

"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:

Attached is a patch that might be considered (remove static for these
globals).

Actually, they are not globals AFAICS, so removing the header extern
seemed the more appropriate fix.

regards, tom lane