public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH RFA: Build stages 2 and 3 with C++
@ 2011-07-16  7:48 Ian Lance Taylor
  2011-07-16  8:00 ` Andrew Pinski
                   ` (6 more replies)
  0 siblings, 7 replies; 57+ messages in thread
From: Ian Lance Taylor @ 2011-07-16  7:48 UTC (permalink / raw)
  To: gcc-patches, gcc

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

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  <iant@google.com>

	* 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.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 4538 bytes --]

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2011-11-22 20:55 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-16  7:48 PATCH RFA: Build stages 2 and 3 with C++ Ian Lance Taylor
2011-07-16  8:00 ` Andrew Pinski
2011-07-16  8:39   ` Ian Lance Taylor
2011-07-16  9:04     ` Basile Starynkevitch
2011-07-17  3:34       ` Ian Lance Taylor
2011-07-16 16:44 ` Diego Novillo
2011-07-17  2:30   ` Ian Lance Taylor
2011-07-17 14:29     ` Richard Guenther
2011-07-17 14:31       ` Eric Botcazou
2011-07-17 18:31         ` Richard Guenther
2011-07-17 19:09           ` Markus Trippelsdorf
2011-07-17 20:21             ` Markus Trippelsdorf
2011-09-04 17:20   ` Thomas Schwinge
2011-07-17  1:02 ` Toon Moene
2011-07-19 20:21 ` Ian Lance Taylor
2011-07-20  1:15   ` Gabriel Dos Reis
2011-07-20  2:06   ` H.J. Lu
2011-07-20  2:52     ` H.J. Lu
2011-07-20  6:23     ` Ian Lance Taylor
2011-07-20 11:24       ` Richard Guenther
2011-07-20  6:05   ` David Edelsohn
2011-07-20  9:03     ` Jonathan Wakely
2011-07-20 10:37       ` Jonathan Wakely
2011-07-20 13:01         ` David Edelsohn
2011-07-20 13:06           ` Richard Guenther
2011-07-20 13:15             ` Diego Novillo
2011-07-20 14:29               ` Ian Lance Taylor
2011-07-20 15:53                 ` Jonathan Wakely
2011-07-20 15:35   ` Toon Moene
2011-07-20 15:47     ` Ian Lance Taylor
2011-07-20 15:59       ` David Edelsohn
2011-07-20 16:21         ` Ian Lance Taylor
2011-07-20 20:26           ` David Edelsohn
2011-07-20 21:00             ` Ian Lance Taylor
2011-07-20 21:06               ` Mike Stump
2011-07-20 22:16                 ` Ian Lance Taylor
2011-07-21  8:36                   ` Basile Starynkevitch
2011-07-21 16:01                     ` Ian Lance Taylor
2011-07-21 16:17                       ` Jakub Jelinek
2011-07-21 18:31                         ` Ian Lance Taylor
2011-07-21 20:00                           ` Basile Starynkevitch
2011-07-21 22:05                             ` Ian Lance Taylor
2011-07-21  4:06                 ` David Edelsohn
2011-07-21  8:13                   ` Eric Botcazou
2011-07-21 13:15               ` David Edelsohn
2011-07-22  8:11                 ` Ian Lance Taylor
2011-07-22 11:59                   ` Paolo Carlini
2011-07-20 16:36         ` Thomas Schwinge
2011-07-20 21:40     ` Toon Moene
2011-08-08 18:59 ` Romain Geissler
2011-08-08 19:41   ` Ian Lance Taylor
2011-08-08 20:56     ` Romain Geissler
2011-11-22 17:55 ` Gary Funck
2011-11-22 18:12   ` Ian Lance Taylor
2011-11-22 19:32 ` Gary Funck
2011-11-22 20:54   ` Ian Lance Taylor
2011-11-22 21:12     ` Gary Funck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).