Boost logo

Boost :

Subject: Re: [boost] [scope_exit] trunk tests fail on sun compiler
From: Stefan Teleman (stefan.teleman_at_[hidden])
Date: 2012-04-04 19:02:52


On Wed, Apr 4, 2012 at 17:27, lcaminiti <lorcaminiti_at_[hidden]> wrote:
>
> Vicente Botet wrote
>>
>> <toolset>sun:<define>BOOST_TYPEOF_EMULATION
>>
>
> Actually adding this to the Jamfile:
>
> <toolset>sun:<define>__typeof__=__typeof__
>
> is a better workaround because having __typeof__ defined will prevent
> Boost.Config from defining it to "typeof":
>
> ...
> #  ifndef __typeof__
> #     define __typeof__ typeof // boost/config/platform/linux.hpp:103
> #  endif
> ...
>
> So Boost.Typeof will be able to use Sun's native __typeof__ :)
>
> We still should fix the actual issue in Boost.Config -- but I'm not sure
> how... maybe replacing __GNUC__:
>
> // boost/config/platform/linux.hpp
> #ifndef __GNUC__
> //
> // if the compiler is not gcc we still need to be able to parse
> // the GNU system headers, some of which (mainly <stdint.h>)
> // use GNU specific extensions:
> //
> //...
> #  ifndef __typeof__
> #     define __typeof__ typeof // boost/config/platform/linux.hpp:103
> #  endif
>
> with:
>
> #if !defined(__GNUC__) && (!defined(__SUNPRO_CC) || __SUNPRO_CC < 0x590)
>
> Note that Sun has __typeof__ since version 5.9.
>
> But I'm not familiar enough with the Boost.Config platform stuff to make any
> change to it... any taker?

You do not need these defines, and you do not need to redefine typeof
as __typeof__ for SunProCC. You only need to pass the correct flags to
the Sun C++ compiler:

[steleman_at_darthvader][~/tmp][04/04/2012 19:00:53][1104]>> cat ./typeof.cc
#include <iostream>

int
main (int argc, char* argv[])
{
    typeof (typeof (char*)[4]) y0;
    typeof (int*) y1[4];
    char* y2[4];
    int* y3[4];

    std::cerr << argv[0] << std::endl;

    return 0;
}

[steleman_at_darthvader][~/tmp][04/04/2012 19:01:00][1105]>>
/opt/oracle/solarisstudio12.3/bin/CC -m32 -g -xO3 -Qoption ccfe
-features=gcc typeof.cc -o typeofCC
[steleman_at_darthvader][~/tmp][04/04/2012 19:01:05][1106]>> ./typeofCC
./typeofCC
[steleman_at_darthvader][~/tmp][04/04/2012 19:01:10][1107]>> echo $status
0
[steleman_at_darthvader][~/tmp][04/04/2012 19:01:14][1108]>>
/opt/oracle/solarisstudio12.3/bin/CC -V
CC: Sun C++ 5.12 Linux_i386 2011/11/16
[steleman_at_darthvader][~/tmp][04/04/2012 19:01:20][1109]>> uname -a
Linux darthvader 2.6.34.10-0.4-desktop #1 SMP PREEMPT 2011-10-19
22:16:41 +0200 x86_64 x86_64 x86_64 GNU/Linux
[steleman_at_darthvader][~/tmp][04/04/2012 19:01:21][1110]>>

--Stefan

-- 
Stefan Teleman
KDE e.V.
stefan.teleman_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk