Re: Can't Build 7.3.4 on OS X

From: Eric Ridge <ebr(at)tcdi(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hunter Hillegas <lists(at)lastonepicked(dot)com>, Theodore Petrosky <tedpet5(at)yahoo(dot)com>, Johan Henselmans <johan(at)netsense(dot)nl>, PostgreSQL <pgsql-general(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org, Marko Karppinen <karppinen(at)pobox(dot)com>
Subject: Re: Can't Build 7.3.4 on OS X
Date: 2003-09-21 22:04:03
Message-ID: 82E4FCAD-EC7F-11D7-A174-0003930C70D8@tcdi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general pgsql-hackers

On Sep 21, 2003, at 3:11 PM, Tom Lane wrote:

> BTW, is anyone interested in looking into whether we can be made to
> build without using either flag? I tried it and saw a number of

I did this... before I knew about -no-cpp-precomp. :( I read all
about -traditional-cpp in the gcc man page, but could never find the
corresponding "not traditional cpp" flag.

It boiled down to two things: use of macros that used the
"stringification" syntax, and whitespace around marco arguments.

Take src/include/nodes/nodes.h, around line 265 for example:

#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_#_type_))
...
#define IsA(nodeptr, _type_) (nodeTag(nodeptr) == T_#_type_)

gcc 3.3 just didn't like this. So I had to fake it out:

#define T_UNDER() T_
#define makeNode(_type_) ((_type_ *)
newNode(sizeof(_type_),T_UNDER()_type_))
...
#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_UNDER()_type_)

But it gets better. Apparently with gcc 3.3 whitespace around macro
arguments is preserved! So, in the case of calls to (at least) the IsA
macro:

before: if (IsA(foo, Short))
after: if (IsA(foo,Short))
^----------------- no space!

From what I could tell, the statement would be expanded into (using my
re-defined version above):
if (nodeTag(nodeptr) == T_ Short)

which of course isn't legal syntax b/c of the space.

So I went through with some Perl and did a bunch of global
substitutions on the files that gcc complained about. There were a few
more than the above examples, but not too many.

> too. It would be interesting to understand what the problem is.

There it is.

eric

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Eric Ridge 2003-09-21 22:10:49 Re: Can't Build 7.3.4 on OS X
Previous Message Marko Karppinen 2003-09-21 20:45:26 Re: [GENERAL] Can't Build 7.3.4 on OS X

Browse pgsql-general by date

  From Date Subject
Next Message Eric Ridge 2003-09-21 22:10:49 Re: Can't Build 7.3.4 on OS X
Previous Message Marko Karppinen 2003-09-21 20:45:26 Re: [GENERAL] Can't Build 7.3.4 on OS X

Browse pgsql-hackers by date

  From Date Subject
Next Message Eric Ridge 2003-09-21 22:10:49 Re: Can't Build 7.3.4 on OS X
Previous Message Marko Karppinen 2003-09-21 20:45:26 Re: [GENERAL] Can't Build 7.3.4 on OS X