[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
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Dec 20 16:29:47 UTC 2015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205453
Dimitry Andric <dim at FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bapt at FreeBSD.org,
| |dim at FreeBSD.org,
| |theraven at FreeBSD.org
--- Comment #2 from Dimitry Andric <dim at FreeBSD.org> ---
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 on the CC list for the bug.
More information about the freebsd-ppc
mailing list