Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Dec 2011 13:20:47 +0100
From:      Ed Schouten <ed@80386.nl>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r228495 - head/sys/sys
Message-ID:  <20111215122047.GN1771@hoeg.nl>
In-Reply-To: <20111214234615.B3839@besplex.bde.org>
References:  <201112140909.pBE99bS3090646@svn.freebsd.org> <20111214234615.B3839@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <ed@80386.nl>
 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111215122047.GN1771>