From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29835 invoked by alias); 16 Jul 2011 06:53:10 -0000 Received: (qmail 29817 invoked by uid 22791); 16 Jul 2011 06:53:08 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_CX,T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Jul 2011 06:52:52 +0000 Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id p6G6qpv8012673 for ; Fri, 15 Jul 2011 23:52:51 -0700 Received: from iwn8 (iwn8.prod.google.com [10.241.68.72]) by kpbe11.cbf.corp.google.com with ESMTP id p6G6qoqD022864 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 15 Jul 2011 23:52:50 -0700 Received: by iwn8 with SMTP id 8so1704548iwn.28 for ; Fri, 15 Jul 2011 23:52:50 -0700 (PDT) Received: by 10.43.53.4 with SMTP id vo4mr4276029icb.395.1310799169255; Fri, 15 Jul 2011 23:52:49 -0700 (PDT) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id v16sm1378578ibe.17.2011.07.15.23.52.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jul 2011 23:52:48 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org Subject: PATCH RFA: Build stages 2 and 3 with C++ Date: Sat, 16 Jul 2011 06:56:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00263.txt.bz2 --=-=-= Content-length: 1224 I would like to propose this patch as a step toward building gcc using a C++ compiler. This patch builds stage1 with the C compiler as usual, and defaults to building stages 2 and 3 with a C++ compiler built during stage 1. This means that the gcc installed and used by most people will be built by a C++ compiler. This will ensure that gcc is fully buildable with C++, while retaining the ability to bootstrap with only a C compiler, not a C++ compiler. This will permit us to experiment with optionally using C++ for some code, using a #ifdef to select the C implementation or the C++ implementation. I would suggest that we consider releasing 4.7 this way, as a small trial for building gcc with C++. This is a big step, so I am sending the patch to both gcc@ and gcc-patches@ for comments. Bootstrapped and ran testsuite on x86_64-unknown-linux-gnu. Ian 2011-07-15 Ian Lance Taylor * configure.ac: Add --enable-build-poststage1-with-cxx. If set, make C++ a boot_language. Set and substitute POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.tpl (POSTSTAGE1_CONFIGURE_FLAGS): New variable. (STAGE[+id+]_CONFIGURE_FLAGS): Add $(POSTSTAGE1_CONFIGURE_FLAGS). * configure, Makefile.in: Rebuild. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=foo.patch Content-Description: patch Content-length: 4538 Index: configure.ac =================================================================== --- configure.ac (revision 176348) +++ configure.ac (working copy) @@ -1126,6 +1126,13 @@ AC_ARG_ENABLE(build-with-cxx, ENABLE_BUILD_WITH_CXX=$enableval, ENABLE_BUILD_WITH_CXX=no) +# Build stage1 with C and build stages 2 and 3 with C++. +AC_ARG_ENABLE(build-poststage1-with-cxx, +[AS_HELP_STRING([--enable-build-poststage1-with-cxx], + [build stages 2 and 3 with C++, not C])], +ENABLE_BUILD_POSTSTAGE1_WITH_CXX=$enableval, +ENABLE_BUILD_POSTSTAGE1_WITH_CXX=yes) + # Used for setting $lt_cv_objdir _LT_CHECK_OBJDIR @@ -1696,9 +1703,11 @@ if test -d ${srcdir}/gcc; then exit 1 fi - if test "$language" = "c++" \ - && test "$ENABLE_BUILD_WITH_CXX" = "yes"; then - boot_language=yes + if test "$language" = "c++"; then + if test "$ENABLE_BUILD_WITH_CXX" = "yes" \ + || test "$ENABLE_BUILD_POSTSTAGE1_WITH_CXX" = "yes"; then + boot_language=yes + fi fi case ,${enable_languages}, in @@ -2397,10 +2406,10 @@ case "$have_compiler:$host:$target:$enab ;; esac -case ",$enable_languages,:$ENABLE_BUILD_WITH_CXX:$enable_bootstrap" in - *,c++,*:yes:yes) ;; - *:yes:yes) - AC_MSG_ERROR([bootstrapping with --enable-build-with-cxx requires c++ in --enable-languages]) +case ",$enable_languages,:,$ENABLE_BUILD_WITH_CXX,$ENABLE_BUILD_POSTSTAGE1_WITH_CXX,:$enable_bootstrap" in + *,c++,*:*:*) ;; + *:*,yes,*:yes) + AC_MSG_ERROR([bootstrapping with --enable-build-with-cxx or --enable-build-postage1-with-cxx requires c++ in --enable-languages]) ;; esac @@ -3188,6 +3197,15 @@ case ${enable_werror} in esac AC_SUBST(stage2_werror_flag) +# If using ENABLE_BUILD_POSTSTAGE1_WITH_CXX, pass +# --enable-build-with-cxx after stage1. +if test "$ENABLE_BUILD_POSTSTAGE1_WITH_CXX" = "yes"; then + POSTSTAGE1_CONFIGURE_FLAGS=--enable-build-with-cxx +else + POSTSTAGE1_CONFIGURE_FLAGS= +fi +AC_SUBST(POSTSTAGE1_CONFIGURE_FLAGS) + # Specify what files to not compare during bootstrap. compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*" Index: Makefile.tpl =================================================================== --- Makefile.tpl (revision 176348) +++ Makefile.tpl (working copy) @@ -416,6 +416,7 @@ TFLAGS = STAGE_CFLAGS = $(BOOT_CFLAGS) STAGE_TFLAGS = $(TFLAGS) STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@ +POSTSTAGE1_CONFIGURE_FLAGS = @POSTSTAGE1_CONFIGURE_FLAGS@ [+ FOR bootstrap-stage +] # Defaults for stage [+id+]; some are overridden below. @@ -426,7 +427,10 @@ STAGE[+id+]_CXXFLAGS = $(CXXFLAGS) STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS) @endif target-libstdc++-v3-bootstrap STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS) -STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS) +# STAGE1_CONFIGURE_FLAGS overridden below, so we can use +# POSTSTAGE1_CONFIGURE_FLAGS here. +STAGE[+id+]_CONFIGURE_FLAGS = \ + $(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS) [+ ENDFOR bootstrap-stage +] # Only build the C compiler for stage1, because that is the only one that @@ -444,6 +448,9 @@ STAGE1_LANGUAGES = @stage1_languages@ # the last argument when conflicting --enable arguments are passed. # * Likewise, we force-disable coverage flags, since the installed # compiler probably has never heard of them. +# * Don't remove this, because above we added +# POSTSTAGE1_CONFIGURE_FLAGS to STAGE[+id+]_CONFIGURE_FLAGS, which +# we don't want for STAGE1_CONFIGURE_FLAGS. STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \ --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" Index: gcc/doc/install.texi =================================================================== --- gcc/doc/install.texi (revision 176348) +++ gcc/doc/install.texi (working copy) @@ -1286,6 +1286,13 @@ will try to guess whether the @code{.ini Build GCC using a C++ compiler rather than a C compiler. This is an experimental option which may become the default in a later release. +@item --enable-build-poststage1-with-cxx +When bootstrapping, build stages 2 and 3 of GCC using a C++ compiler +rather than a C compiler. Stage 1 is still built with a C compiler. +This is an experimental option which may become the default in a later +release. This is enabled by default and may be disabled using +@option{--disable-build-poststage1-with-cxx}. + @item --enable-maintainer-mode The build rules that regenerate the Autoconf and Automake output files as well as the GCC master message catalog @file{gcc.pot} are normally --=-=-=--