From owner-freebsd-toolchain@freebsd.org Sun Dec 20 16:29:47 2015 Return-Path: Delivered-To: freebsd-toolchain@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 7D677A4D60C for ; Sun, 20 Dec 2015 16:29:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (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 534521755 for ; Sun, 20 Dec 2015 16:29:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id tBKGTlFa085918 for ; Sun, 20 Dec 2015 16:29:47 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-toolchain@FreeBSD.org Subject: [Bug 205453] 11.0-CURRENT libcxxrt/guard.cc uses C11's _Static_assert in conditionally-compiled C++ code and when it is used buildworld fails for syntax errors in g++ compilers Date: Sun, 20 Dec 2015 16:29:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dim@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-toolchain@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2015 16:29:47 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205453 Dimitry Andric changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bapt@FreeBSD.org, | |dim@FreeBSD.org, | |theraven@FreeBSD.org --- Comment #2 from Dimitry Andric --- Hm, this _Static_assert has an interesting history. The original review from Baptiste, https://reviews.freebsd.org/D1390, used static_assert(), but this required -std=c++11 to compile, otherwise you would get: contrib/libcxxrt/guard.cc:104:1: error: C++ requires a type specifier for all declarations static_assert(sizeof(guard_t) == sizeof(uint64_t), ""); ^~~~~~~~~~~~~ This is the version upstream eventually also used, since they apparently assume C++11 there. David suggested changing it to _Static_assert(): "This should work if you change it to _Static_assert, which I think we support for all C/C++ versions." Now that I look at the code again, I am not entirely sure why the static assertion is only for the big endian #ifdef block. It would seem more useful to put it a few lines lower, for the !_LP64 case. That said, even when moving the _Static_assert() like that, it compiles fine for me, both with base gcc, and several versions of ports gcc (I tried gcc 4.8, 4.9 and 5.2). On the other hand, your sample program indeed does not compile with the ports versions of gcc. I'm not sure where those versions are getting their version of _Static_assert() from, though... -- You are receiving this mail because: You are the assignee for the bug.