I'll be glad to see this functionality.  Initially, I was against the idea 
of what __attribute__ does (especially, its 'lint' functionality, which 
I'm still against), but after porting some gcc code to Sun Studio, I've 
come to like __attribute__ more than #pragma's.  __attribute__ feels more 
natural when declaring something, like a packed structure, or an aligned 
8-byte array.

Thanks,

Derek E. Lewis
dlewis at solnetworks.net
http://riemann.solnetworks.net/~dlewis

On Wed, 2 Aug 2006, Chris Quenelle wrote:

>
> The Sun C compiler is working on implementing a bunch of
> __attribute__ syntax to be more compatible with gcc.
> You might want to check the bugs and RFE's (and maybe file
> an RFE) for this.  I don't recall off hand if this
> is one of the ones we're already doing.
>
> --chris
>
>
>
>
> Bart Smaalders wrote:
>> Alan Coopersmith wrote:
>> 
>>> Yes - in X code, we use these macros to allow compiling with gcc,
>>> Sun Studio, or other compilers:
>>> 
>>> #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
>>> # define _X_EXPORT      __attribute__((visibility("default")))
>>> # define _X_HIDDEN      __attribute__((visibility("hidden")))
>>> # define _X_INTERNAL    __attribute__((visibility("internal")))
>>> #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
>>> # define _X_EXPORT      __global
>>> # define _X_HIDDEN      __hidden
>>> # define _X_INTERNAL    __hidden
>>> #else /* not gcc >= 3.3 and not Sun Studio >= 8 */
>>> # define _X_EXPORT
>>> # define _X_HIDDEN
>>> # define _X_INTERNAL
>>> #endif
>>> 
>>> It does require making sure the macro is used at the beginning of
>>> the declaration as Sun Studio requires, instead of the end as gcc
>>> allows, but you can write code acceptable to both like this:
>>> _X_HIDDEN int
>>> xf86KbdOn(void)
>>> {
>>> ...
>>> 
>>> You can also just use linker mapfiles with all compilers as well,
>>> but that may not be as portable to other OS'es.
>>>
>>>     -Alan Coopersmith-           alan.coopersmith at sun.com
>>>      Sun Microsystems, Inc. - X Window System Engineering
>> 
>> 
>> 
>> This looks like something that should be be part of Solaris, doesn't
>> it?
>> 
>> - Bart
>> 
>> Bart Smaalders            Solaris Kernel Performance
>> barts at cyber.eng.sun.com        http://blogs.sun.com/barts
>> _______________________________________________
>> tools-linking mailing list
>> tools-linking at opensolaris.org
> _______________________________________________
> tools-linking mailing list
> tools-linking at opensolaris.org
>
>

Reply via email to