Re: [HACKERS] __cpu__ defines

2003-09-12 Thread Larry Rosenman


--On Friday, September 12, 2003 09:53:10 -0400 Bruce Momjian 
[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


pgp0.pgp
Description: PGP signature


Re: [HACKERS] __cpu__ defines

2003-09-12 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes:
 As part of my spinlock testing, I noticed that we test for __cpu__ when
 using gcc, and __cpu when not using gcc.
 ...
 So, I wonder if we should be testing _just_ for __cpu, perhaps starting
 in 7.5.

I might be all wet on this, but I had the idea that the __cpu__ forms
were considered more standard/common.  In any case, I can't see any
good reason not to test for both.  The amount of code saved by checking
only one is negligible; why should we take a chance on breaking things
for that?

regards, tom lane

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] __cpu__ defines

2003-09-12 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  As part of my spinlock testing, I noticed that we test for __cpu__ when
  using gcc, and __cpu when not using gcc.
  ...
  So, I wonder if we should be testing _just_ for __cpu, perhaps starting
  in 7.5.
 
 I might be all wet on this, but I had the idea that the __cpu__ forms
 were considered more standard/common.  In any case, I can't see any
 good reason not to test for both.  The amount of code saved by checking
 only one is negligible; why should we take a chance on breaking things
 for that?

Yes, that what confuses me --- which is standard.  Right now, we aren't
consistent.  My patch tests for __cpu__ on gcc, and both on non-gcc,
which seems safest.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

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


Re: [HACKERS] __cpu__ defines

2003-09-12 Thread Peter Eisentraut
Bruce Momjian writes:

 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):

gcc only documents the __foo__ version, so there is a small reason to lean
in that direction if you want to make it uniform.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] __cpu__ defines

2003-09-12 Thread Bruce Momjian
Peter Eisentraut wrote:
 Bruce Momjian writes:
 
  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):
 
 gcc only documents the __foo__ version, so there is a small reason to lean
 in that direction if you want to make it uniform.

Oh, that helps, so my logic of testing for only __foo__ on gcc, and both
when the compiler isn't gcc or isn't known is correct.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

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