Skip to content

Commit bbae512

Browse files
committed
[C++11] Replace autoconf --enable-cxx11 with --enable-cxx1y. The
baseline is now C++11, and we unconditionally add -std=c++11 to the flags. This has the dim potential to break some non-GNU-compatible compiler (in terms of -std flags) using the makefiles, but those makefiles are littered with GNU-style compile flags so it would be very surprising to me for it to actually happen in practice. As always, do let me know if there is a toolchain you're using where this doesn't work, and I'll be watching the bots. llvm-svn: 202569
1 parent 620b890 commit bbae512

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

llvm/Makefile.config.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ RDYNAMIC := @RDYNAMIC@
244244
#ENABLE_LIBCPP = 0
245245
ENABLE_LIBCPP = @ENABLE_LIBCPP@
246246

247-
# When ENABLE_CXX11 is enabled, LLVM uses c++11 mode by default to build.
248-
ENABLE_CXX11 = @ENABLE_CXX11@
247+
# When ENABLE_CXX1Y is enabled, LLVM uses c++1y mode by default to build.
248+
# Otherwise it uses the baseline c++11.
249+
ENABLE_CXX1Y = @ENABLE_CXX1Y@
249250

250251
# When ENABLE_SPLIT_DWARF is enabled, LLVM uses -gfission to build in debug mode.
251252
ENABLE_SPLIT_DWARF = @ENABLE_SPLIT_DWARF@

llvm/Makefile.rules

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,10 @@ ifeq ($(ENABLE_LIBCPP),1)
319319
LD.Flags += -stdlib=libc++
320320
endif
321321

322-
ifeq ($(ENABLE_CXX11),1)
323-
CXX.Flags += -std=c++11
322+
ifeq ($(ENABLE_CXX1Y),1)
323+
CXX.Flags += -std=c++1y
324+
else
325+
CXX.Flags += -std=c++11
324326
endif
325327

326328
ifeq ($(ENABLE_WERROR),1)

llvm/autoconf/configure.ac

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,16 @@ bypass these sanity checks.])])
589589
;;
590590
esac
591591

592-
dnl --enable-cxx11 : check whether or not to use -std=c++11 on the command line
593-
AC_ARG_ENABLE(cxx11,
594-
AS_HELP_STRING([--enable-cxx11],
595-
[Use c++11 if available (default is YES)]),,
592+
dnl --enable-cxx1y : check whether or not to use -std=c++1y on the command line
593+
AC_ARG_ENABLE(cxx1y,
594+
AS_HELP_STRING([--enable-cxx1y],
595+
[Use c++1y if available (default is NO)]),,
596596
enableval=default)
597597
case "$enableval" in
598-
yes) AC_SUBST(ENABLE_CXX11,[1]) ;;
599-
no) AC_SUBST(ENABLE_CXX11,[0]) ;;
600-
default) AC_SUBST(ENABLE_CXX11,[1]);;
601-
*) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;;
598+
yes) AC_SUBST(ENABLE_CXX1Y,[1]) ;;
599+
no) AC_SUBST(ENABLE_CXX1Y,[0]) ;;
600+
default) AC_SUBST(ENABLE_CXX1Y,[0]);;
601+
*) AC_MSG_ERROR([Invalid setting for --enable-cxx1y. Use "yes" or "no"]) ;;
602602
esac
603603

604604
dnl --enable-fission : check whether or not to use -gsplit-dwarf on the command

llvm/configure

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ BUILD_EXEEXT
684684
BUILD_CXX
685685
CVSBUILD
686686
ENABLE_LIBCPP
687-
ENABLE_CXX11
687+
ENABLE_CXX1Y
688688
ENABLE_SPLIT_DWARF
689689
ENABLE_CLANG_ARCMT
690690
ENABLE_CLANG_STATIC_ANALYZER
@@ -1402,7 +1402,7 @@ Optional Features:
14021402
--enable-compiler-version-checks
14031403
Check the version of the host compiler (default is
14041404
YES)
1405-
--enable-cxx11 Use c++11 if available (default is YES)
1405+
--enable-cxx1y Use c++1y if available (default is NO)
14061406
--enable-split-dwarf Use split-dwarf if available (default is NO)
14071407
--enable-clang-arcmt Enable building of clang ARCMT (default is YES)
14081408
--enable-clang-static-analyzer
@@ -4804,22 +4804,22 @@ echo "$as_me: error: Invalid setting for --enable-compiler-version-checks. Use \
48044804
;;
48054805
esac
48064806

4807-
# Check whether --enable-cxx11 was given.
4808-
if test "${enable_cxx11+set}" = set; then
4809-
enableval=$enable_cxx11;
4807+
# Check whether --enable-cxx1y was given.
4808+
if test "${enable_cxx1y+set}" = set; then
4809+
enableval=$enable_cxx1y;
48104810
else
48114811
enableval=default
48124812
fi
48134813

48144814
case "$enableval" in
4815-
yes) ENABLE_CXX11=1
4815+
yes) ENABLE_CXX1Y=1
48164816
;;
4817-
no) ENABLE_CXX11=0
4817+
no) ENABLE_CXX1Y=0
48184818
;;
4819-
default) ENABLE_CXX11=1
4819+
default) ENABLE_CXX1Y=0
48204820
;;
4821-
*) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-cxx11. Use \"yes\" or \"no\"" >&5
4822-
echo "$as_me: error: Invalid setting for --enable-cxx11. Use \"yes\" or \"no\"" >&2;}
4821+
*) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-cxx1y. Use \"yes\" or \"no\"" >&5
4822+
echo "$as_me: error: Invalid setting for --enable-cxx1y. Use \"yes\" or \"no\"" >&2;}
48234823
{ (exit 1); exit 1; }; } ;;
48244824
esac
48254825

@@ -20165,7 +20165,7 @@ BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim
2016520165
BUILD_CXX!$BUILD_CXX$ac_delim
2016620166
CVSBUILD!$CVSBUILD$ac_delim
2016720167
ENABLE_LIBCPP!$ENABLE_LIBCPP$ac_delim
20168-
ENABLE_CXX11!$ENABLE_CXX11$ac_delim
20168+
ENABLE_CXX1Y!$ENABLE_CXX1Y$ac_delim
2016920169
ENABLE_SPLIT_DWARF!$ENABLE_SPLIT_DWARF$ac_delim
2017020170
ENABLE_CLANG_ARCMT!$ENABLE_CLANG_ARCMT$ac_delim
2017120171
ENABLE_CLANG_STATIC_ANALYZER!$ENABLE_CLANG_STATIC_ANALYZER$ac_delim

0 commit comments

Comments
 (0)