Thread: AIX check in datetime.h

AIX check in datetime.h

From
Joachim Wieland
Date:
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



Re: AIX check in datetime.h

From
Bruce Momjian
Date:
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. +


Re: AIX check in datetime.h

From
Tom Lane
Date:
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


Re: AIX check in datetime.h

From
Tom Lane
Date:
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


Re: AIX check in datetime.h

From
Bruce Momjian
Date:
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. +


Re: AIX check in datetime.h

From
Christopher Browne
Date:
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> 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."


Re: AIX check in datetime.h

From
Andrew Dunstan
Date:
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



Re: AIX check in datetime.h

From
Tom Lane
Date:
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


Re: AIX check in datetime.h

From
Christopher Browne
Date:
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>