From owner-freebsd-current@freebsd.org Fri Aug 25 06:32:17 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 135F5DF0B15 for ; Fri, 25 Aug 2017 06:32:17 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-57.reflexion.net [208.70.210.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9EA174F77 for ; Fri, 25 Aug 2017 06:32:16 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 8147 invoked from network); 25 Aug 2017 06:32:09 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 25 Aug 2017 06:32:09 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v8.40.2) with SMTP; Fri, 25 Aug 2017 02:32:09 -0400 (EDT) Received: (qmail 31944 invoked from network); 25 Aug 2017 06:32:09 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 25 Aug 2017 06:32:09 -0000 Received: from [192.168.1.109] (c-67-170-167-181.hsd1.or.comcast.net [67.170.167.181]) by iron2.pdx.net (Postfix) with ESMTPSA id 9CF8FEC9255; Thu, 24 Aug 2017 23:32:08 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r322875 - head/sys/dev/nvme Message-Id: <1C5A448F-C91A-4599-8500-E4E46E6F5205@dsl-only.net> Date: Thu, 24 Aug 2017 23:32:07 -0700 To: imp@FreeBSD.org, svn-src-head@freebsd.org, FreeBSD Current , FreeBSD-STABLE Mailing List , freebsd-hackers X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 06:32:17 -0000 > Author: imp > Date: Fri Aug 25 04:33:06 2017 > New Revision: 322875 > URL:=20 > https://svnweb.freebsd.org/changeset/base/322875 >=20 >=20 > Log: > Use _Static_assert > =20 > These files are compiled in userland too, so we can't use = sys/systm.h > and rely on CTASSERT. Switch to using _Static_assert instead. > =20 > MFC After: 3 days > Sponsored by: Netflix >=20 > Modified: > head/sys/dev/nvme/nvme.h > head/sys/dev/nvme/nvme_util.c As I remember _Static_assert is from C11, not the older C99. As I understand head/sys/dev/nvme/nvme.h use by C++ code could now reject attempts to use _Static_assert . There have been at least one old bugzilla report for such. An example is 205453 (back around 2015-Dec). =46rom back then: > # more main.cc > #include "/usr/include/sys/cdefs.h" > _Static_assert(1,"Test"); > int main(void) > { > return 0; > } >=20 > For example: >=20 > # g++49 main.cc > main.cc:2:15: error: expected constructor, destructor, or type = conversion before '(' token > _Static_assert(1,"Test"); > . . . > g++49, g++5, and powerpc64-portbld-freebsd11.0-g++ all reject the = above source the same way that libcxxrt/guard.cc compiles are rejected = during powerpc64-portbld-freebsd11.0-g++ based buildworld lib32 -m32 = compiles.=20 >=20 > gcc49, gcc5, and powerpc64-portbld-freebsd11.0-gcc all accept the = above instead (when in main.c instead of main.cc so it is handle as C = code), with or without the include. _Static_assert is specific to C11 = and is not part of C++. It takes explicit definitions to make the syntax = acceptable as C++. >=20 > Note: clang++ (3.7) accepts the use of the C11 _Static_assert, with or = without the include, going well outside the C++ language definition. >=20 > . . . >=20 > Fixed in r297299 . (The context was a C++ file head/contrib/libcxxrt/guard.cc so C++'s static_assert was used instead and -std=3Dc++11 was added for the library in question [libcxxrt].) Unless head/sys/dev/nvme/nvme.h is not to be used from C++ code: use of _Static_assert in the header would appear to be a problem. =3D=3D=3D Mark Millard markmi at dsl-only.net