Re: __cpu__ defines

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: __cpu__ defines
Date: 2003-09-12 14:34:57
Message-ID: 20620000.1063377297@lerlaptop-red.iadfw.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

--On Friday, September 12, 2003 09:53:10 -0400 Bruce Momjian
<pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

> As part of my spinlock testing, I noticed that we test for __cpu__ when
> using gcc, and __cpu when not using gcc. However, I see that my i386
> gcc 2.95 defines both (shown using src/tools/ccsym):
>
> __GNUC__=2
> __GNUC_MINOR__=95
> unix
> __i386__
> i386
> __bsdi__
> bsdi
> __ELF__
> __GAS__=2
> __GAS_MINOR__=10
> __unix__
> __i386__
> __i386__
> __bsdi__
> __bsdi__
> __ELF__
> __GAS__=2
> __GAS_MINOR__=10
> __unix
> __i386
> __bsdi
> system=unix
> system=bsd
> cpu=i386
> machine=i386
> cpu=i386
> machine=i386
> i386
> __i386
> __i386__
>
> So, I wonder if we should be testing _just_ for __cpu, perhaps starting
> in 7.5.
I corresponded with Dave Prosser of SCO, and he pointed me at the #assert
stuff. That's where the xxx=xxx stuff comes from.

Might it make more sense to use
#if #cpu(i386)
xxx
#endif

instead of depending on the different flavors of #defines.

GCC and at least SCO's cc support this.

I sent the details to Tom, since he seems to be the spinlock maintainer.

LER

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alessio Bragadini 2003-09-12 14:45:27 Re: Beta2 Tag'd and Bundled ...
Previous Message Tom Lane 2003-09-12 14:33:40 Re: [PATCHES] Reorganization of spinlock defines

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-09-12 14:46:06 Re: [PATCHES] Reorganization of spinlock defines
Previous Message Tom Lane 2003-09-12 14:33:40 Re: [PATCHES] Reorganization of spinlock defines