From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21462 invoked by alias); 20 Feb 2013 16:06:48 -0000 Received: (qmail 21442 invoked by uid 22791); 20 Feb 2013 16:06:47 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_BF X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Feb 2013 16:06:31 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1U8CBh-0003ng-Hw from Thomas_Schwinge@mentor.com ; Wed, 20 Feb 2013 08:06:29 -0800 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 20 Feb 2013 08:06:29 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.1.289.1; Wed, 20 Feb 2013 16:06:26 +0000 From: Thomas Schwinge To: Carlos O'Donell , Richard Henderson CC: , , Subject: Re: Usage of __attribute__used__ in (system) headers? In-Reply-To: References: <87r4khnbqm.fsf@kepler.schwinge.homeip.net> <51227F2E.5060103@twiddle.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Wed, 20 Feb 2013 16:06:00 -0000 Message-ID: <87vc9nc6ma.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00048.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 5158 Hi! On Mon, 18 Feb 2013 14:00:03 -0500, Carlos O'Donell wrote: > I think you should update the MIPS nan.h version to > match the generic version [...] Yes, I already had prepared such a patch and planned to commit it "as obvious", without discussion. Thusly pushed in commit 2636ffe65438af689e12b7977fe8609a6ca07c90: ports/ * sysdeps/mips/bits/nan.h: Align to generic IEEE 754 file. diff --git ports/sysdeps/mips/bits/nan.h ports/sysdeps/mips/bits/nan.h index ffbb3b5..af168ce 100644 --- ports/sysdeps/mips/bits/nan.h +++ ports/sysdeps/mips/bits/nan.h @@ -1,4 +1,4 @@ -/* `NAN' constant for IEEE 754 machines. +/* `NAN' constant for IEEE 754 machines. MIPS version. Copyright (C) 1992-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. =20 @@ -13,7 +13,7 @@ Lesser General Public License for more details. =20 You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see + License along with the GNU C Library; if not, see . */ =20 #ifndef _MATH_H @@ -21,20 +21,21 @@ #endif =20 =20 -/* IEEE Not A Number (QNaN). Note that MIPS has the QNaN and SNaN patterns - reversed compared to most other architectures. The IEEE spec left - the definition of this open to implementations, and for MIPS the top - bit of the mantissa must be SET to indicate a SNaN. */ +/* IEEE Not A Number. */ +/* Note that MIPS has the QNaN and SNaN patterns reversed compared to most + other architectures. The IEEE spec left the definition of this open to + implementations, and for MIPS the top bit of the mantissa must be SET to + indicate a SNaN. */ =20 #if __GNUC_PREREQ(3,3) =20 -# define NAN (__builtin_nanf("")) +# define NAN (__builtin_nanf ("")) =20 #elif defined __GNUC__ =20 # define NAN \ - (__extension__ = \ - ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })= \ + (__extension__ \ + ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; = }) \ { __l: 0x7fbfffffUL }).__d) =20 #else I also added . On Mon, 18 Feb 2013 14:41:02 -0500, Carlos O'Donell wrote: > On Mon, Feb 18, 2013 at 2:21 PM, Richard Henderson wrot= e: > > On 02/18/2013 11:00 AM, Carlos O'Donell wrote: > >>> > static union { unsigned char __c[4]; float __d; } __nan_union > >>> > - __attribute_used__ =3D { __nan_bytes }; > >>> > + =3D { __nan_bytes }; > >>> > # define NAN (__nan_union.__d) > >>> > > >>> > #endif /* GCC. */ In commit 72f0ffdcbeb8135d04cf2dc73f8a5f5c7783a283, I first add the missing __attribute_used__: ports/ * sysdeps/mips/bits/nan.h [!__GNUC__] (__nan_union): Add __attribute_used__. diff --git ports/sysdeps/mips/bits/nan.h ports/sysdeps/mips/bits/nan.h index af168ce..71f372d 100644 --- ports/sysdeps/mips/bits/nan.h +++ ports/sysdeps/mips/bits/nan.h @@ -49,7 +49,8 @@ # define __nan_bytes { 0xff, 0xff, 0xbf, 0x7f } # endif =20 -static union { unsigned char __c[4]; float __d; } __nan_union =3D { __nan_= bytes }; +static union { unsigned char __c[4]; float __d; } __nan_union + __attribute_used__ =3D { __nan_bytes }; # define NAN (__nan_union.__d) =20 #endif /* GCC. */ > >> I disagree, it's useful to mark the non-GCC version with > >> an __attribute_used__ such that in the future we might > >> use another compiler without problems. > > > > The annotation should not be attribute used at all, but rather unused. Good catch, thanks! > glibc doesn't have an __attribute_unused__. It doesn't need one; per 's __attribute_used__ definition, we assume that any compiler that supports __attribute__ at all also supports __attribute__ ((unused)). So, I see no reason to introduce __attribute_unused__ bit instead directly use __attribute__ ((unused)); commit c7b275d6b3bceb6b400fa3044d13d1001bc605ca: * sysdeps/ieee754/bits/nan.h [!__GNUC__] (__nan_union): Change __attribute_used__ to __attribute__ ((unused)). ports/ * sysdeps/mips/bits/nan.h [!__GNUC__] (__nan_union): Change __attribute_used__ to __attribute__ ((unused)). diff --git ports/sysdeps/mips/bits/nan.h ports/sysdeps/mips/bits/nan.h index 71f372d..8f4666d 100644 --- ports/sysdeps/mips/bits/nan.h +++ ports/sysdeps/mips/bits/nan.h @@ -50,7 +50,7 @@ # endif =20 static union { unsigned char __c[4]; float __d; } __nan_union - __attribute_used__ =3D { __nan_bytes }; + __attribute__ ((unused)) =3D { __nan_bytes }; # define NAN (__nan_union.__d) =20 #endif /* GCC. */ diff --git sysdeps/ieee754/bits/nan.h sysdeps/ieee754/bits/nan.h index d3ab38b..a1e6a51 100644 --- sysdeps/ieee754/bits/nan.h +++ sysdeps/ieee754/bits/nan.h @@ -46,7 +46,7 @@ # endif =20 static union { unsigned char __c[4]; float __d; } __nan_union - __attribute_used__ =3D { __nan_bytes }; + __attribute__ ((unused)) =3D { __nan_bytes }; # define NAN (__nan_union.__d) =20 #endif /* GCC. */ Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJRJPR+AAoJENuKOtuXzphJsNEIAJ4CFoNN5Dfs7/0D+tn8phdB H1tP+r7TClNnJLDEdFUKyYO69N4ydzESHnQLxiiUGEtAhypyiT6RtIwJXKCfPPZF 4BegwbKWgJ7fUF7PhPY1KFZ9etrfpPfV9UEi93u/fRT2/fuYl6aXpaM8X3nn1bia UQ++W93x/g4QOSf46EBkW24ZsZUVfyyRP6S4PU3CMHN6j6zWeC/Oko4ryByQnFaR fiFtsGoWSvq7RJhOOheh43sF1rQOzhKioyM90JeI9JlfJGM7OgeYieEuqHheF3gm zI+1u2iWhuY74+bGJTFR3evxROoMpWgEpxqlCgRpo8w6akdToAa9RLS5VLBv9Jo= =XnTM -----END PGP SIGNATURE----- --=-=-=--