Re: [GENERAL] Can't Build 7.3.4 on OS X

Поиск
Список
Период
Сортировка
От Eric Ridge
Тема Re: [GENERAL] Can't Build 7.3.4 on OS X
Дата
Msg-id 82E4FCAD-EC7F-11D7-A174-0003930C70D8@tcdi.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Can't Build 7.3.4 on OS X  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Eric Ridge
Дата:
Сообщение: Re: [GENERAL] Can't Build 7.3.4 on OS X
Следующее
От: Hans-Jürgen Schönig
Дата:
Сообщение: Re: PostgreSQL 7.4beta3 does not compile on AIX 5 ...