From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NR8bm-0003Vz-Sx for mharc-grub-devel@gnu.org; Sat, 02 Jan 2010 13:21:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NR8bl-0003Vm-IT for grub-devel@gnu.org; Sat, 02 Jan 2010 13:21:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NR8bg-0003V4-Oo for grub-devel@gnu.org; Sat, 02 Jan 2010 13:21:49 -0500 Received: from [199.232.76.173] (port=55366 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NR8bg-0003V1-Hx for grub-devel@gnu.org; Sat, 02 Jan 2010 13:21:44 -0500 Received: from mail-fx0-f228.google.com ([209.85.220.228]:59978) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NR8bg-0002jr-Rp for grub-devel@gnu.org; Sat, 02 Jan 2010 13:21:45 -0500 Received: by fxm28 with SMTP id 28so5233543fxm.26 for ; Sat, 02 Jan 2010 10:21:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=dMSQigPosSrTxUagTnes/pANlDXweTY32h37ee5o6N0=; b=cqF0u4U+J716S6hk37nIFo8TqKm/UIXv+6swzj14AO9EizJnW3UZ9z/RxHnnk9XLaN jickqvzx1W1l8E/BwRrdhprShwNPB6eQ9GO72tdwyGBUjahACoZAYvm1OIdZd/5M8DDj Z/yl5iHQTc+yP0bqWTPbvt8HswITC0wZcybMg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=s63jdoN8kSLonGMwuIsPn8DV/TeSarDCN/UwWv8BLHnJEa8Ubda468QbduQTAeuPes 1WIn4tnh99UgcjYGwvWxgS/yqxvHSQjx9+rUB+YmzRXb/5Cw0dOORUV7aGMZEq2/y4zw Tu/ns+bVEzznJkteIU4WnLM6jW0Piz8Vu4ZAc= Received: by 10.87.17.20 with SMTP id u20mr1546165fgi.32.1262456502518; Sat, 02 Jan 2010 10:21:42 -0800 (PST) Received: from debian.bg45.phnet (106-31.77-83.cust.bluewin.ch [83.77.31.106]) by mx.google.com with ESMTPS id e20sm37795453fga.12.2010.01.02.10.21.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 02 Jan 2010 10:21:41 -0800 (PST) Message-ID: <4B3F8EA1.7020106@gmail.com> Date: Sat, 02 Jan 2010 19:21:21 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GNU GRUB References: <4B3F42EC.1010100@labri.fr> <20100102153738.GX5847@riva.ucam.org> In-Reply-To: <20100102153738.GX5847@riva.ucam.org> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigE0EC191FBF744ED77AC0C118" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Disable -Werror when error attribute generates warnings X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 18:21:49 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE0EC191FBF744ED77AC0C118 Colin Watson wrote: > On Sat, Jan 02, 2010 at 01: 58:20PM +0100, Gr=C3=A9goire Sutre wrote: > =20 >> With an older version of gcc that does not understand the error =20 >> attribute, gcc generates warnings when compiling files that include =20 >> include/grub/list.h. Since TARGET_CFLAGS contains -Werror by default,= =20 >> the build of modules fails. >> >> The following patch checks whether the C compiler supports the error = >> attribute without warning, and disables -Werror if that is not the cas= e =20 >> (as otherwise the build will fail). >> =20 > > Instead of this, why not only use the attribute if it's available? I > couldn't find an entry about it in GCC's human-readable change > summaries, but support was committed on 2007-09-23 so I think it's > available from GCC 4.3. > > =20 Why not have configure.ac check specifically if this attribute is available and use it only if it is? > I use this GNUC_PREREQ approach in other projects and rather like it. I= t > could be extended to cover our other uses of attributes quite easily. > > 2010-01-02 Colin Watson > > * include/grub/misc.h (GNUC_PREREQ): New macro. > (ATTRIBUTE_ERROR): New macro. > * include/grub/list.h (grub_bad_type_cast_real): Use > ATTRIBUTE_ERROR. > > =3D=3D=3D modified file 'include/grub/list.h' > --- include/grub/list.h 2009-12-31 14:03:09 +0000 > +++ include/grub/list.h 2010-01-02 15:31:44 +0000 > @@ -42,7 +42,7 @@ void EXPORT_FUNC(grub_list_insert) (grub > =20 > static inline void * > grub_bad_type_cast_real (int line, const char *file) > - __attribute__ ((error ("bad type cast between incompatible grub t= ypes"))); > + ATTRIBUTE_ERROR ("bad type cast between incompatible grub types")= ; > =20 > static inline void * > grub_bad_type_cast_real (int line, const char *file) > > =3D=3D=3D modified file 'include/grub/misc.h' > --- include/grub/misc.h 2009-12-18 02:57:32 +0000 > +++ include/grub/misc.h 2010-01-02 15:31:31 +0000 > @@ -25,6 +25,22 @@ > #include > #include > =20 > +/* GCC version checking borrowed from glibc. */ > +#if defined(__GNUC__) && defined(__GNUC_MINOR__) > +# define GNUC_PREREQ(maj,min) \ > + ((__GNUC__ << 16) + __GNUC_MINOR__ >=3D ((maj) << 16) + (min)) > +#else > +# define GNUC_PREREQ(maj,min) 0 > +#endif > + > +/* Does this compiler support compile-time error attributes? */ > +#if GNUC_PREREQ(4,3) > +# define ATTRIBUTE_ERROR(msg) \ > + __attribute__ ((__error__ (msg))) > +#else > +# define ATTRIBUTE_ERROR(msg) > +#endif > + > #define ALIGN_UP(addr, align) \ > ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) > #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enigE0EC191FBF744ED77AC0C118 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAks/jrMACgkQNak7dOguQgmPHwEAvHx7Hed5rMswTynlgHZbwZzT l3Xwha3AgFu9ITz9VmEBAI8XkdCGFwBQre5A/uYTI7ONrB7bYQrJkL6GVGp4gBV3 =KVsq -----END PGP SIGNATURE----- --------------enigE0EC191FBF744ED77AC0C118--