svn commit: r228478 - head/sys/sys
Author: ed Date: Tue Dec 13 19:39:24 2011 New Revision: 228478 URL: http://svn.freebsd.org/changeset/base/228478 Log: Reimplement CTASSERT() using _Static_assert(). Modified: head/sys/sys/systm.h Modified: head/sys/sys/systm.h == --- head/sys/sys/systm.hTue Dec 13 19:37:27 2011(r228477) +++ head/sys/sys/systm.hTue Dec 13 19:39:24 2011(r228478) @@ -92,10 +92,8 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUES } while (0) #endif -#ifndef CTASSERT /* Allow lint to override */ -#defineCTASSERT(x) _CTASSERT(x, __LINE__) -#define_CTASSERT(x, y) __CTASSERT(x, y) -#define__CTASSERT(x, y)typedef char __assert ## y[(x) ? 1 : -1] +#ifndef CTASSERT /* Allow lint to override */ +#defineCTASSERT(x) _Static_assert(x, compile-time assertion failed) #endif /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228478 - head/sys/sys
On Tue, 13 Dec 2011, Ed Schouten wrote: Author: ed Date: Tue Dec 13 19:39:24 2011 New Revision: 228478 URL: http://svn.freebsd.org/changeset/base/228478 Log: Reimplement CTASSERT() using _Static_assert(). Cool, can we have a second variant with a custom error message? Not having file:line and more information is freakingly unhelpful often when compiling with -jhigh n and our current default compiler. Modified: head/sys/sys/systm.h Modified: head/sys/sys/systm.h == --- head/sys/sys/systm.hTue Dec 13 19:37:27 2011(r228477) +++ head/sys/sys/systm.hTue Dec 13 19:39:24 2011(r228478) @@ -92,10 +92,8 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUES } while (0) #endif -#ifndef CTASSERT /* Allow lint to override */ -#defineCTASSERT(x) _CTASSERT(x, __LINE__) -#define_CTASSERT(x, y) __CTASSERT(x, y) -#define__CTASSERT(x, y)typedef char __assert ## y[(x) ? 1 : -1] +#ifndef CTASSERT /* Allow lint to override */ +#defineCTASSERT(x) _Static_assert(x, compile-time assertion failed) #endif /* -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228478 - head/sys/sys
* Bjoern A. Zeeb bzeeb-li...@lists.zabbadoz.net, 20111213 21:06: Cool, can we have a second variant with a custom error message? Yes; just use _Static_assert for that! It won't print the custom error message right now, but as soon as compilers implement C1X, it will work for you. -- Ed Schouten e...@80386.nl WWW: http://80386.nl/ pgpLMVLDfPelB.pgp Description: PGP signature