From 35b9ea3d0912237f240483c38ad33c2e25cd0e50 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 27 Mar 2016 00:37:54 +0000 Subject: [PATCH] Compile libcxxrt as C++11, since it is only really used in combination with libc++, which is also C++11. Also change one _Static_assert (which is really C11) back into static_assert, like upstream. This should help when compiling libcxxrt with newer versions of gcc, which refuse to recognize any form of static assertions, if not compiling for C++11 or higher. While here, add -nostdinc++ to CFLAGS, to prevent picking up any C++ headers outside the source tree. --- contrib/libcxxrt/guard.cc | 2 +- lib/libcxxrt/Makefile | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/libcxxrt/guard.cc b/contrib/libcxxrt/guard.cc index f1c4c69fa6b9..34d294cf7432 100644 --- a/contrib/libcxxrt/guard.cc +++ b/contrib/libcxxrt/guard.cc @@ -101,7 +101,7 @@ typedef struct { uint32_t init_half; uint32_t lock_half; } guard_t; -_Static_assert(sizeof(guard_t) == sizeof(uint64_t), ""); +static_assert(sizeof(guard_t) == sizeof(uint64_t), ""); static const uint32_t LOCKED = 1; static const uint32_t INITIALISED = static_cast(1) << 24; # endif diff --git a/lib/libcxxrt/Makefile b/lib/libcxxrt/Makefile index d197361a9a66..b580618b8fee 100644 --- a/lib/libcxxrt/Makefile +++ b/lib/libcxxrt/Makefile @@ -20,7 +20,10 @@ SRCS+= libelftc_dem_gnu3.c\ guard.cc WARNS= 0 -CFLAGS+= -I${SRCDIR} +CFLAGS+= -I${SRCDIR} -nostdinc++ +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif VERSION_MAP= ${.CURDIR}/Version.map .include