From 752cabaa1cf94dff142dfe91161f627df793c2f8 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 29 Mar 2019 18:16:33 +0000 Subject: [PATCH] Revert r345704 I accidentally committed code from two reviews. I will reintroduce the code to bsd.progs.mk as part of a separate commit from r345704. Approved by: emaste (mentor, implicit) MFC after: 2 months MFC with: r345704 --- lib/clang/llvm.build.mk | 2 +- lib/libc++/Makefile | 4 +++- lib/libc++experimental/Makefile | 4 +++- lib/libc++fs/Makefile | 4 +++- lib/libc/tests/stdlib/Makefile | 4 ++-- lib/libclang_rt/Makefile.inc | 2 +- lib/libcxxrt/Makefile | 4 +++- lib/libgcc_eh/Makefile.inc | 4 +++- lib/libomp/Makefile | 2 +- lib/ofed/libibnetdisc/Makefile | 3 +++ share/mk/bsd.progs.mk | 4 ++-- share/mk/bsd.sys.mk | 13 ------------- share/mk/googletest.test.inc.mk | 4 ++++ usr.bin/dtc/Makefile | 2 +- usr.sbin/pmc/Makefile | 3 +-- 15 files changed, 31 insertions(+), 28 deletions(-) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index 333574904417..71c0b17d4fdf 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -95,7 +95,7 @@ CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections LDFLAGS+= -Wl,--gc-sections -CXXSTD?= c++11 +CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti CXXFLAGS.clang+= -stdlib=libc++ diff --git a/lib/libc++/Makefile b/lib/libc++/Makefile index d83c4f81c016..50a747c8cfce 100644 --- a/lib/libc++/Makefile +++ b/lib/libc++/Makefile @@ -76,7 +76,9 @@ CFLAGS+= -nostdinc++ CFLAGS+= -nostdlib CFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CFLAGS+= -DLIBCXXRT -CXXSTD= c++11 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif LIBADD+= cxxrt INCSGROUPS= STD EXP EXT diff --git a/lib/libc++experimental/Makefile b/lib/libc++experimental/Makefile index 53c33018b535..8d1e4b58bbe2 100644 --- a/lib/libc++experimental/Makefile +++ b/lib/libc++experimental/Makefile @@ -20,6 +20,8 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -CXXSTD= c++14 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++14 +.endif .include diff --git a/lib/libc++fs/Makefile b/lib/libc++fs/Makefile index ede7d1687d4d..a89c5d6821d4 100644 --- a/lib/libc++fs/Makefile +++ b/lib/libc++fs/Makefile @@ -22,6 +22,8 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -CXXSTD= c++14 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++14 +.endif .include diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index 4a08f8557d08..9f7afa112491 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -50,8 +50,8 @@ PROGS+= h_getopt h_getopt_long CFLAGS+= -I${.CURDIR} -CXXSTD.cxa_thread_atexit_test= c++11 -CXXSTD.cxa_thread_atexit_nothr_test= c++11 +CXXFLAGS.cxa_thread_atexit_test+= -std=c++11 +CXXFLAGS.cxa_thread_atexit_nothr_test+= -std=c++11 LIBADD.cxa_thread_atexit_test+= pthread .for t in h_getopt h_getopt_long diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc index 067e370fe977..1c27a2d83885 100644 --- a/lib/libclang_rt/Makefile.inc +++ b/lib/libclang_rt/Makefile.inc @@ -41,4 +41,4 @@ CFLAGS+= -funwind-tables CXXFLAGS+= -fvisibility-inlines-hidden CXXFLAGS+= -fvisibility=hidden CFLAGS+= -I${CRTSRC}/lib -CXXSTD= c++11 +CXXFLAGS+= -std=c++11 diff --git a/lib/libcxxrt/Makefile b/lib/libcxxrt/Makefile index 49d632650c35..5332024b44a1 100644 --- a/lib/libcxxrt/Makefile +++ b/lib/libcxxrt/Makefile @@ -22,7 +22,9 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ -CXXSTD= c++11 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif VERSION_MAP= ${.CURDIR}/Version.map .include diff --git a/lib/libgcc_eh/Makefile.inc b/lib/libgcc_eh/Makefile.inc index 39cccec7e6d9..5c8af2141382 100644 --- a/lib/libgcc_eh/Makefile.inc +++ b/lib/libgcc_eh/Makefile.inc @@ -27,8 +27,10 @@ CXXFLAGS.${file}+= -fno-exceptions -funwind-tables .endfor CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif CXXFLAGS+= -fno-rtti -CXXSTD= c++11 STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC # Probably need to just move this earlier or use CXXFLAGS .if ${MK_DIRDEPS_BUILD} == "yes" diff --git a/lib/libomp/Makefile b/lib/libomp/Makefile index c0f1cc1c6db7..bd8fd7769f0a 100644 --- a/lib/libomp/Makefile +++ b/lib/libomp/Makefile @@ -53,9 +53,9 @@ CFLAGS+= -I${ITTSRC} CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections CXXFLAGS+= -fvisibility-inlines-hidden +CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti -CXXSTD= c++11 LDFLAGS+= -Wl,--warn-shared-textrel LDFLAGS+= -Wl,--gc-sections diff --git a/lib/ofed/libibnetdisc/Makefile b/lib/ofed/libibnetdisc/Makefile index 08dbb8861407..f66e58f4b0c0 100644 --- a/lib/ofed/libibnetdisc/Makefile +++ b/lib/ofed/libibnetdisc/Makefile @@ -31,6 +31,9 @@ LIBADD= osmcomp ibmad ibumad CFLAGS+= -DHAVE_CONFIG_H=1 CFLAGS+= -I${_spath} CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/infiniband +.if ${COMPILER_FEATURES:Mc++11} +CXXFLAGS+= -std=c++11 +.endif VERSION_MAP= ${_spath}/libibnetdisc.map .include diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index 36043ef94860..b4ba16dc5993 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -22,8 +22,8 @@ PROGS += ${PROGS_CXX} .if defined(PROG) # just one of many -PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE CSTD CXXSTD DPSRCS MAN \ - NO_WERROR PROGNAME SRCS STRIP WARNS +PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \ + PROGNAME SRCS STRIP WARNS PROG_VARS += CFLAGS CXXFLAGS DEBUG_FLAGS DPADD INTERNALPROG LDADD LIBADD \ LINKS LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 836f23a62c14..f2c78a0c2426 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -24,19 +24,6 @@ CFLAGS+= -std=iso9899:1999 .else # CSTD CFLAGS+= -std=${CSTD} .endif # CSTD - -.if ${COMPILER_FEATURES:Mc++11} -CXXSTD?= c++11 -.elif ${COMPILER_TYPE} == "gcc" -# Prior versions of g++ support C++98 with GNU extensions by default. -CXXSTD?= gnu++98 -.else -# Assume that the compiler supports at least C++98. -CXXSTD?= c++98 -.endif -CXXFLAGS+= -std=${CXXSTD} -# CXXSTD - # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS+= -pedantic .if defined(WARNS) diff --git a/share/mk/googletest.test.inc.mk b/share/mk/googletest.test.inc.mk index 98f0e6a6fbe3..84959658bdbd 100644 --- a/share/mk/googletest.test.inc.mk +++ b/share/mk/googletest.test.inc.mk @@ -1,9 +1,13 @@ # $FreeBSD$ +# XXX: this should be defined in bsd.sys.mk +CXXSTD?= c++11 + GTESTS_CXXFLAGS+= -DGTEST_HAS_POSIX_RE=1 GTESTS_CXXFLAGS+= -DGTEST_HAS_PTHREAD=1 GTESTS_CXXFLAGS+= -DGTEST_HAS_STREAM_REDIRECTION=1 GTESTS_CXXFLAGS+= -frtti +GTESTS_CXXFLAGS+= -std=${CXXSTD} # XXX: src.libnames.mk should handle adding this directory for libgtest's, # libgmock's, etc, headers. diff --git a/usr.bin/dtc/Makefile b/usr.bin/dtc/Makefile index 92769609d034..a834f622601f 100644 --- a/usr.bin/dtc/Makefile +++ b/usr.bin/dtc/Makefile @@ -6,7 +6,7 @@ MAN= dtc.1 WARNS?= 3 -CXXFLAGS+= -fno-rtti -fno-exceptions +CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO diff --git a/usr.sbin/pmc/Makefile b/usr.sbin/pmc/Makefile index 44ee356bde18..090134711b92 100644 --- a/usr.sbin/pmc/Makefile +++ b/usr.sbin/pmc/Makefile @@ -6,8 +6,7 @@ PROG_CXX= pmc MAN= WARNS?= 3 -CXXFLAGS+= -O0 -CXXSTD= c++14 +CXXFLAGS+= -O0 -std=c++14 CWARNFLAGS.gcc+= -Wno-redundant-decls LIBADD= kvm pmc m ncursesw pmcstat elf