This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Usage of __attribute__used__ in (system) headers?


Hi!

I found that sysdeps/ieee754/bits/nan.h is different from
ports/sysdeps/mips/bits/nan.h in that the former has seen the following
change, whereas the latter has not been updated accordingly:

| commit b575c52b86fe0c00adec925e356eb72cf95b23a7
| Author: Ulrich Drepper <drepper@redhat.com>
| Date:   Fri Apr 16 22:04:55 2004 +0000
| 
|     Update.
|     
|     2004-04-16  Ulrich Drepper  <drepper@redhat.com>
|     
|     	* sysdeps/ieee754/bits/nan.h (__nan_union): Add __attribute_used__
|     	attribute to keep gcc quiet.
| 
| [...]
| --- sysdeps/ieee754/bits/nan.h
| +++ sysdeps/ieee754/bits/nan.h
| @@ -46,7 +46,8 @@
|  #  define __nan_bytes		{ 0, 0, 0xc0, 0x7f }
|  # endif
|  
| -static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
| +static union { unsigned char __c[4]; float __d; } __nan_union
| +    __attribute_used__ = { __nan_bytes };
|  # define NAN	(__nan_union.__d)
|  
|  #endif	/* GCC.  */

This code in question (cited/changed above) is only ever used for
non-__GNUC__-defining compilers.  If my reading of misc/sys/cdefs.h is
correct, for these compilers, the attribute declaration is not applied
anyway.  So, instead of adding it to the MIPS copy of that file, I
suggest we remove it from the generic one.  OK?

diff --git sysdeps/ieee754/bits/nan.h sysdeps/ieee754/bits/nan.h
index d3ab38b..00ad0b5 100644
--- sysdeps/ieee754/bits/nan.h
+++ sysdeps/ieee754/bits/nan.h
@@ -46,7 +46,7 @@
 # endif
 
 static union { unsigned char __c[4]; float __d; } __nan_union
-    __attribute_used__ = { __nan_bytes };
+  = { __nan_bytes };
 # define NAN	(__nan_union.__d)
 
 #endif	/* GCC.  */


GrÃÃe,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]