Bug#688357: sys/cdefs.h #defines __attribute__ to nothing without __GNUC__

brian m. carlson sandals at crustytoothpaste.net
Sat Sep 22 02:35:22 UTC 2012


reassign 688357 libc6-dev
retitle 688357 sys/cdefs.h #defines __attribute__ to nothing without __GNUC__
kthxbye

This is not actually a bug in clang, but a bug in eglibc.  In
sys/cdefs.h, __attribute__ is #defined to nothing if __GNUC__ is not
set.  However, there are other compilers that support this syntax, such
as clang and the Intel compiler.  clang #defines __GNUC__ to 4 by
default, but this is buggy because it is not fully compatible with GCC
(see 653256).  Therefore, when using clang -U__GNUC__, my __attribute__
statements get defined to nothing, and things break.

eglibc should not do this if __clang__ is defined, because clang does
support these extensions.  You might want to consider supporting the
Intel compiler as well, although I don't much care if you decide not to.

A testcase is attached.  If you remove the #include and preprocess the
code with -U__GNUC__, the attribute stays.  If you don't, the attribute
magically disappears.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.c
Type: text/x-csrc
Size: 133 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20120922/0a332bb1/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20120922/0a332bb1/attachment.pgp>


More information about the Pkg-llvm-team mailing list