AIX check in datetime.h

Started by Joachim Wielandover 19 years ago9 messages
#1Joachim Wieland
joe@mcknight.de

Can someone please explain why in include/utils/datetime.h (struct datetkn)
there is a check for _AIX that either initializes a char* pointer or a char
array? Is there any advantage of a char-array except for warnings of some
compilers if the initilization string is too long?

Apart from that I doubt that AIX cannot handle token[TOKMAXLEN] because
similar declarations can be found in other headers without the _AIX check.

The struct definition is more than 9 years old and seems to show up first in
Attic/dt.h.

#define TOKMAXLEN 10 /* only this many chars are stored in
* datetktbl */

/* keep this struct small; it gets used a lot */
typedef struct
{
#if defined(_AIX)
char *token;
#else
char token[TOKMAXLEN];
#endif /* _AIX */
char type;
char value; /* this may be unsigned, alas */
} datetkn;

Joachim

#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Joachim Wieland (#1)
Re: AIX check in datetime.h

Wow, that is strange. We could remove it for 8.2 and see how testing goes.

---------------------------------------------------------------------------

Joachim Wieland wrote:

Can someone please explain why in include/utils/datetime.h (struct datetkn)
there is a check for _AIX that either initializes a char* pointer or a char
array? Is there any advantage of a char-array except for warnings of some
compilers if the initilization string is too long?

Apart from that I doubt that AIX cannot handle token[TOKMAXLEN] because
similar declarations can be found in other headers without the _AIX check.

The struct definition is more than 9 years old and seems to show up first in
Attic/dt.h.

#define TOKMAXLEN 10 /* only this many chars are stored in
* datetktbl */

/* keep this struct small; it gets used a lot */
typedef struct
{
#if defined(_AIX)
char *token;
#else
char token[TOKMAXLEN];
#endif /* _AIX */
char type;
char value; /* this may be unsigned, alas */
} datetkn;

Joachim

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: AIX check in datetime.h

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Joachim Wieland wrote:

Can someone please explain why in include/utils/datetime.h (struct datetkn)
there is a check for _AIX that either initializes a char* pointer or a char
array?

Wow, that is strange. We could remove it for 8.2 and see how testing goes.

It looks like a workaround for some ancient compiler problem. [ digs
for awhile... ] Very ancient: we inherited that hack from Berkeley, see
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/Attic/nabstime.h

I bet we can remove it.

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#3)
Re: AIX check in datetime.h

I wrote:

It looks like a workaround for some ancient compiler problem. [ digs
for awhile... ] Very ancient: we inherited that hack from Berkeley,

In fact, now that I know where to look, I find the same thing in the
postgres-v4r2 tarball, which means the hack is pre-1994. I don't have
anything older to look at.

regards, tom lane

#5Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#3)
Re: AIX check in datetime.h

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Joachim Wieland wrote:

Can someone please explain why in include/utils/datetime.h (struct datetkn)
there is a check for _AIX that either initializes a char* pointer or a char
array?

Wow, that is strange. We could remove it for 8.2 and see how testing goes.

It looks like a workaround for some ancient compiler problem. [ digs
for awhile... ] Very ancient: we inherited that hack from Berkeley, see
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/Attic/nabstime.h

I bet we can remove it.

OK, removed. Let's see if we get failure feedback.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#6Christopher Browne
cbbrowne@acm.org
In reply to: Tom Lane (#3)
Re: AIX check in datetime.h

In an attempt to throw the authorities off his trail, pgman@candle.pha.pa.us (Bruce Momjian) transmitted:

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Joachim Wieland wrote:

Can someone please explain why in include/utils/datetime.h (struct datetkn)
there is a check for _AIX that either initializes a char* pointer or a char
array?

Wow, that is strange. We could remove it for 8.2 and see how testing goes.

It looks like a workaround for some ancient compiler problem. [ digs
for awhile... ] Very ancient: we inherited that hack from Berkeley, see
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/Attic/nabstime.h

I bet we can remove it.

OK, removed. Let's see if we get failure feedback.

I haven't been monitoring CVS HEAD, but you can be sure this will get
tried out when 8.2 gets anywhere vaguely close to relese...
--
If this was helpful, <http://svcs.affero.net/rm.php?r=cbbrowne&gt; rate me
http://linuxdatabases.info/info/slony.html
Signs of a Klingon Programmer - 8. "Debugging? Klingons do not
debug. Our software does not coddle the weak. Bugs are good for
building character in the user."

#7Andrew Dunstan
andrew@dunslane.net
In reply to: Christopher Browne (#6)
Re: AIX check in datetime.h

Christopher Browne wrote:

I haven't been monitoring CVS HEAD, but you can be sure this will get
tried out when 8.2 gets anywhere vaguely close to relese...

The whole point of having a buildfarm is that we shouldn't have to wait,
we should be able to see very quickly if we have broken something.

We currently have AIX coverage for 5.2/ppc with both gcc and (I think)
IBM cc. If we need more coverage then feel free to add other AIX machines.

cheers

andrew

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#7)
Re: AIX check in datetime.h

Andrew Dunstan <andrew@dunslane.net> writes:

The whole point of having a buildfarm is that we shouldn't have to wait,
we should be able to see very quickly if we have broken something.

And in fact kookaburra seems happy ...

regards, tom lane

#9Christopher Browne
cbbrowne@acm.org
In reply to: Tom Lane (#3)
Re: AIX check in datetime.h

Martha Stewart called it a Good Thing when andrew@dunslane.net (Andrew Dunstan) wrote:

Christopher Browne wrote:

I haven't been monitoring CVS HEAD, but you can be sure this will get
tried out when 8.2 gets anywhere vaguely close to relese...

The whole point of having a buildfarm is that we shouldn't have to
wait, we should be able to see very quickly if we have broken
something.

We currently have AIX coverage for 5.2/ppc with both gcc and (I think)
IBM cc. If we need more coverage then feel free to add other AIX
machines.

I'd very much to add an AIX 5.3 system; that's awaiting some sysadmin
activity that is more urgent...
--
output = ("cbbrowne" "@" "gmail.com")
http://linuxdatabases.info/info/internet.html
``What this means is that when people say, "The X11 folks should have
done this, done that, or included this or that", they really should be
saying "Hey, the X11 people were smart enough to allow me to add this,
that and the other myself."'' -- David B. Lewis <dbl@motifzone.com>