From owner-svn-src-head@freebsd.org Sun Feb 25 13:52:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAEB7F2F677; Sun, 25 Feb 2018 13:52:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B2A07DE49; Sun, 25 Feb 2018 13:52:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 877B48256; Sun, 25 Feb 2018 14:52:15 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_92DF56FF-F7D7-45FA-AFB1-0CB893F50C11"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r329910 - head/sys/cddl/contrib/opensolaris/uts/common/sys Date: Sun, 25 Feb 2018 14:52:14 +0100 In-Reply-To: <201802241601.w1OG1LQ3043733@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Alan Somers References: <201802241601.w1OG1LQ3043733@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2018 13:52:27 -0000 --Apple-Mail=_92DF56FF-F7D7-45FA-AFB1-0CB893F50C11 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 24 Feb 2018, at 17:01, Alan Somers wrote: >=20 > Author: asomers > Date: Sat Feb 24 16:01:21 2018 > New Revision: 329910 > URL: https://svnweb.freebsd.org/changeset/base/329910 >=20 > Log: > Implement CTASSERT using _Static_assert >=20 > Prevents warnings about "unused typedef" with GCC-6 >=20 > Reported by: GCC-6 > MFC after: 18 days > X-MFC-With: 329722 >=20 > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h >=20 > Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.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=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Sat Feb = 24 15:13:20 2018 (r329909) > +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Sat Feb = 24 16:01:21 2018 (r329910) > @@ -133,8 +133,8 @@ _NOTE(CONSTCOND) } while (0) > #ifndef CTASSERT > #define CTASSERT(x) _CTASSERT(x, __LINE__) > #define _CTASSERT(x, y) __CTASSERT(x, y) > -#define __CTASSERT(x, y) \ > - typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1] > +#define __CTASSERT(x, y) \ > + _Static_assert((x), "Static assert failed at " #y) > #endif >=20 > #ifdef _KERNEL Note that the trick with the negatively indexed array is to support older versions of gcc, which did not yet recognize _Static_assert. It looks like this was added in gcc 4.6. -Dimitry --Apple-Mail=_92DF56FF-F7D7-45FA-AFB1-0CB893F50C11 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWpK/jgAKCRCwXqMKLiCW o+8tAJwPPAed5zndBo1SRqEESLTJ4vvtXQCeN/dAJzO9qx/8/e39YDV6/Hp1hp0= =emDq -----END PGP SIGNATURE----- --Apple-Mail=_92DF56FF-F7D7-45FA-AFB1-0CB893F50C11--