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


---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster

Reply via email to