Re: about function attributes for functions returning a pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Uwe Kleine-KÃnig <u.kleine-koenig@xxxxxxxxxxxxxx> writes:

>> I think the differences you are seeing are because some attributes can
>> apply to types and some can only apply to declarations.  Moving the
>> location of the __attribute__ affects which type it applies to.  In
>> particular __attribute__ ((unused)) may be used with a type, but
>> __attribute__ ((section (...))) may only be used with a declaration.
>
> As far as I got it both section() and unused are variable/function
> attributes and not type attributes.  So I think this explanation doesn't
> match, does it?

The unused attribute can be used on a type.

typedef int I1 __attribute__ ((unused));
typedef int I2 __attribute__ ((section (".sec")));

foo.c:2: error: section attribute not allowed for âI2â

There is no error for I1.

What the unused attribute means for a type I decline to speculate.  But
it is accepted where type attributes are accepted.  Perhaps this is a
bug.  I'm really not sure.

Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux