> Author: imp
> Date: Fri Aug 25 04:33:06 2017
> New Revision: 322875
> Use _Static_assert
> 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.
> MFC After: 3 days
> Sponsored by: Netflix
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
There have been at least one old bugzilla report
for such. An example is 205453 (back around
>From back then:
> # more main.cc
> #include "/usr/include/sys/cdefs.h"
> int main(void)
> return 0;
> For example:
> # g++49 main.cc
> main.cc:2:15: error: expected constructor, destructor, or type conversion
> before '(' token
> . . .
> 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.
> 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++.
> Note: clang++ (3.7) accepts the use of the C11 _Static_assert, with or
> without the include, going well outside the C++ language definition.
> . . .
> Fixed in r297299 .
(The context was a C++ file head/contrib/libcxxrt/guard.cc so C++'s
static_assert was used instead and -std=c++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.
markmi at dsl-only.net
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"