Re: pre-processor strips out __attribute__((__packed_)_), is this expected?

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

 



28.03.2015 3:30, Daniel Dickman wrote:
> Hello,
> 
> Is there a reason why the pre-processor strips out attributes when
> -U__GNUC__ is specified and there is at least 1 #include directive?
> This seems like surprising behaviour to me. Here's an example:
> 
>     $ cat foo.c
>     #include <limits.h>

Yes, this is intended behavior. The GNU C Library (glibc) defines
__attribute__ as a macro, which expands to whitespace if __GNUC__ is not
defined:

#if !defined __GNUC__ || __GNUC__ < 2
# define __attribute__(xyz) /* Ignore */
#endif

It is defined in such way to make the code compatible with other
compilers which do not support __attribute__ syntax.

-- 
Regards,
    Mikhail Maltsev




[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