From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 12:20:49 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B6301065672; Thu, 15 Dec 2011 12:20:49 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 9ECED8FC1A; Thu, 15 Dec 2011 12:20:48 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id AE0BF2A28CD6; Thu, 15 Dec 2011 13:20:47 +0100 (CET) Date: Thu, 15 Dec 2011 13:20:47 +0100 From: Ed Schouten To: Bruce Evans Message-ID: <20111215122047.GN1771@hoeg.nl> References: <201112140909.pBE99bS3090646@svn.freebsd.org> <20111214234615.B3839@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xTKfHyrFnSV9DG3y" Content-Disposition: inline In-Reply-To: <20111214234615.B3839@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2011 12:20:49 -0000 --xTKfHyrFnSV9DG3y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Bruce, After reading through your email, I think it's best to fix things using the following patch. Essentially it does the following: - It makes sure __alignof() is always present, by defining it as a macro for GCC < 2.95. - All the C1X macros can now be implemented using the ones we already had (__dead2, etc). This means we don't need to repeat all the compiler version specific checks. - While there, add struct __hack to the _Static_assert, as it always requires a semicolon. Thanks for your feedback. | Index: sys/sys/cdefs.h | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | --- sys/sys/cdefs.h (revision 228504) | +++ sys/sys/cdefs.h (working copy) | @@ -230,27 +230,24 @@ | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L | /* Do nothing. They are language keywords. */ | #else | -/* Not supported. Implement them manually. */ | -#ifdef __GNUC__ | -#define _Alignas(e) __attribute__((__aligned__(e))) | -#define _Alignof(e) __alignof__(e) | -#define _Noreturn __attribute__((__noreturn__)) | +/* Not supported. Implement them using our versions. */ | +#define _Alignas(e) __aligned(e) | +#define _Alignof(e) __alignof(e) | +#define _Noreturn __dead2 | #define _Thread_local __thread | -#else | -#define _Alignas(e) | -#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) | -#define _Noreturn | -#define _Thread_local | -#endif | #ifdef __COUNTER__ | #define _Static_assert(e, s) __Static_assert(e, __COUNTER__) | #define __Static_assert(e, c) ___Static_assert(e, c) | #define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] | #else | -#define _Static_assert(e, s) | +#define _Static_assert(e, s) struct __hack | #endif | #endif | =20 | +#if !__GNUC_PREREQ__(2, 95) | +#define __alignof(x) __offsetof(struct { char __a; e __b; }, __b) | +#endif | + | #if __GNUC_PREREQ__(2, 96) | #define __malloc_like __attribute__((__malloc__)) | #define __pure __attribute__((__pure__)) --=20 Ed Schouten WWW: http://80386.nl/ --xTKfHyrFnSV9DG3y Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO6eYfAAoJEG5e2P40kaK7hM0P/1Nl06aivaqmH7u54AWA48hN cRfNqL3ExyeB00ayAgrFoD3IOJ6txoufsWvqOlvGRQh5Alf9GDDdJ6DOQ94K4mu1 IuDbT6lkKmitlwvFSRD5lC7UqORtvU7GTelVXuq4N2onwFCe79FQc5tsME89bBVx o49f0ODsOiAMwRwFgD9GPkHB2J1tOhWjEvdj0P+otrtrcl4aHNdhYUxpVP9kM3iA xHwy2Z1utn7ufFutd5/8xZvyPs7kSzs0OC0wAdSFYbEWl/mIpEkCj60RXiTkurfx hVM9OmWLGtKfkK6yC6mls9gsTPbhL2KC0IO5KjplwjZknTHnBpHdMLG2AeyWrpmi OebgPK4Pwjf+X+nNlBb9ttkvANF9XIcMZVzaVqg7Y8SlUDQPDgHB8MrlGvZoZu9i XRmrW0B4ntqfcVfcjotWiKvJrdCv5eYhCK6cbA4CEoatzua8GgI6TeYQGLRG3oWh s9azf/5Wv3XW8asppNj3O9JjJ/db8rBoekmI4mBFC/UXvsLFgjkKRfYHUFyJggJu f1s1q51pMqtqzPUWB37R1iVxfZTrQAe/sitybSukXN/k2u0k3/x47OGHqJ/anUvR 8ZuASDEZ+opI97tTt1cIbFXmhj9QJGlAE27TLWwyh9JNehRArL0HMLtU8nrZuNR1 gxUoZofFurRXr3Z8Yz0V =AIeb -----END PGP SIGNATURE----- --xTKfHyrFnSV9DG3y--