Thread: 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
"Pedro J. Lobo"
Date:
Hi, all.

Someone has changed the "#if defined(__alpha)" tests that existed in
include/storage/s_lock.h in 6.5.1 to "#if defined(__alpha__)". The problem
is that DEC (¿Compaq?) C only defines __alpha, (gcc defines both __alpha
and __alpha__) so it doesn't work anymore.

In fact, there are two places where the test is used, one inside a "#if
defined(__GNUC__)" and the other one inside the corresponding "#else". It
seems that the easiest sollution is to change the check inside the "#else"
back to "#if defined(__alpha)".

Cheers,

    Pedro.

--
-------------------------------------------------------------------
Pedro José Lobo Perea                   Tel:    +34 91 336 78 19
Centro de Cálculo                       Fax:    +34 91 331 92 29
E.U.I.T. Telecomunicación               e-mail: pjlobo@euitt.upm.es
Universidad Politécnica de Madrid
Ctra. de Valencia, Km. 7                E-28031 Madrid - España / Spain


Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
Tom Lane
Date:
"Pedro J. Lobo" <pjlobo@euitt.upm.es> writes:
> Someone has changed the "#if defined(__alpha)" tests that existed in
> include/storage/s_lock.h in 6.5.1 to "#if defined(__alpha__)". The problem
> is that DEC (�Compaq?) C only defines __alpha, (gcc defines both __alpha
> and __alpha__) so it doesn't work anymore.

I thought that was bogus when it was done.  Should be
    #if defined(__alpha) || defined(__alpha__)
to cover both compilers.

> In fact, there are two places where the test is used, one inside a "#if
> defined(__GNUC__)" and the other one inside the corresponding "#else". It
> seems that the easiest sollution is to change the check inside the "#else"
> back to "#if defined(__alpha)".

... which would break whichever compiler is being used by the person who
submitted the patch.  I don't think it was changed on a whim.

            regards, tom lane

Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
Bruce Momjian
Date:
> "Pedro J. Lobo" <pjlobo@euitt.upm.es> writes:
> > Someone has changed the "#if defined(__alpha)" tests that existed in
> > include/storage/s_lock.h in 6.5.1 to "#if defined(__alpha__)". The problem
> > is that DEC (�Compaq?) C only defines __alpha, (gcc defines both __alpha
> > and __alpha__) so it doesn't work anymore.
>
> I thought that was bogus when it was done.  Should be
>     #if defined(__alpha) || defined(__alpha__)
> to cover both compilers.
>
> > In fact, there are two places where the test is used, one inside a "#if
> > defined(__GNUC__)" and the other one inside the corresponding "#else". It
> > seems that the easiest sollution is to change the check inside the "#else"
> > back to "#if defined(__alpha)".
>
> ... which would break whichever compiler is being used by the person who
> submitted the patch.  I don't think it was changed on a whim.

I recommend putting something in the alpha template to define __alpha,
so we don't have to double-compare everywhere.  I will make the change
now.


--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
Bruce Momjian
Date:
> "Pedro J. Lobo" <pjlobo@euitt.upm.es> writes:
> > Someone has changed the "#if defined(__alpha)" tests that existed in
> > include/storage/s_lock.h in 6.5.1 to "#if defined(__alpha__)". The problem
> > is that DEC (�Compaq?) C only defines __alpha, (gcc defines both __alpha
> > and __alpha__) so it doesn't work anymore.
>
> I thought that was bogus when it was done.  Should be
>     #if defined(__alpha) || defined(__alpha__)
> to cover both compilers.
>
> > In fact, there are two places where the test is used, one inside a "#if
> > defined(__GNUC__)" and the other one inside the corresponding "#else". It
> > seems that the easiest sollution is to change the check inside the "#else"
> > back to "#if defined(__alpha)".
>
> ... which would break whichever compiler is being used by the person who
> submitted the patch.  I don't think it was changed on a whim.

New code in Makefile.alpha is:

    /* some platforms define __alpha, but not __alpha__ */
    #if defined(__alpha) && !defined(__alpha__)
    #define __alpha__
    #endif

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
Tom Lane
Date:
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> New code in Makefile.alpha is:

>     /* some platforms define __alpha, but not __alpha__ */
>     #if defined(__alpha) && !defined(__alpha__)
>     #define __alpha__
>     #endif

OK, so we're going to standardize on __alpha__ to recognize that
platform?  OK by me, unless the Alpha users know a reason not to.

But the above doesn't belong in Makefile.alpha does it?  I'd have
thought include/port/alpha.h, since __alpha__ is being looked for
by C code not makefiles.

BTW, a quick glimpse shows no occurrences of __alpha except in
contrib/int8/int8.c, which is presumably unmaintained dead code now
that int8 is in the mainstream.  Shouldn't we delete contrib/int8
entirely?

            regards, tom lane

Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
Bruce Momjian
Date:
> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > New code in Makefile.alpha is:
>
> >     /* some platforms define __alpha, but not __alpha__ */
> >     #if defined(__alpha) && !defined(__alpha__)
> >     #define __alpha__
> >     #endif
>
> OK, so we're going to standardize on __alpha__ to recognize that
> platform?  OK by me, unless the Alpha users know a reason not to.
>
> But the above doesn't belong in Makefile.alpha does it?  I'd have
> thought include/port/alpha.h, since __alpha__ is being looked for
> by C code not makefiles.

Moved to port/alpha.h, both trees.

>
> BTW, a quick glimpse shows no occurrences of __alpha except in
> contrib/int8/int8.c, which is presumably unmaintained dead code now
> that int8 is in the mainstream.  Shouldn't we delete contrib/int8
> entirely?

contrib/int8 removed.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [PORTS] Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
Uncle George
Date:
egcs, also defines both __alpha & __alpha__
( if u havent't test there already ) I believe this covers all avail compiled
on the Digital Alpha  box
gat
Tom Lane wrote:

> "Pedro J. Lobo" <pjlobo@euitt.upm.es> writes:
> > Someone has changed the "#if defined(__alpha)" tests that existed in
> > include/storage/s_lock.h in 6.5.1 to "#if defined(__alpha__)". The problem
> > is that DEC (¿Compaq?) C only defines __alpha, (gcc defines both __alpha
> > and __alpha__) so it doesn't work anymore.
>
> I thought that was bogus when it was done.  Should be
>         #if defined(__alpha) || defined(__alpha__)
> to cover both compilers.
>
> > In fact, there are two places where the test is used, one inside a "#if
> > defined(__GNUC__)" and the other one inside the corresponding "#else". It
> > seems that the easiest sollution is to change the check inside the "#else"
> > back to "#if defined(__alpha)".
>
> ... which would break whichever compiler is being used by the person who
> submitted the patch.  I don't think it was changed on a whim.
>
>                         regards, tom lane
>
> ************


Re: [BUGS] 6.5.2 broken on alpha/Tru64 Unix 4.0d/cc

From
"Pedro J. Lobo"
Date:
On Fri, 8 Oct 1999, Tom Lane wrote:

>Bruce Momjian <maillist@candle.pha.pa.us> writes:
>> New code in Makefile.alpha is:
>
>>     /* some platforms define __alpha, but not __alpha__ */
>>     #if defined(__alpha) && !defined(__alpha__)
>>     #define __alpha__
>>     #endif
>
>OK, so we're going to standardize on __alpha__ to recognize that
>platform?  OK by me, unless the Alpha users know a reason not to.

I don't see any. The only problem I can see is that __alpha (or __alpha__)
used to mean "Alpha/Tru64 Unix", and this is no longer true because of
Alpha/Linux. If there is any place in the code that's valid only for
Alpha/Tru64, then __osf__ should be used.

For example, s_lock.h uses the msem_xxx functions to implement spinlocks
when gcc is not used. These functions are related to msemaphores, which
are semaphores that live in shared memory segments (or "mmap"ed files). I
don't know wheter this group of functions is specific to Tru64 Unix, but
at least FreeBSD doesn't have them. If Alpha/Linux doesn't have them, then
__osf__ should be used there instead of __alpha__ (or at least a
combination of both).

Regards,

    Pedro.

--
-------------------------------------------------------------------
Pedro José Lobo Perea                   Tel:    +34 91 336 78 19
Centro de Cálculo                       Fax:    +34 91 331 92 29
E.U.I.T. Telecomunicación               e-mail: pjlobo@euitt.upm.es
Universidad Politécnica de Madrid
Ctra. de Valencia, Km. 7                E-28031 Madrid - España / Spain