public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: PATCH to use -std=c++98 in stage 1 of bootstrap
@ 2015-05-20 17:27 Jason Merrill
  2015-05-20 22:16 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2015-05-20 17:27 UTC (permalink / raw)
  To: gcc-patches List, Alexandre Oliva

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

I want to explicitly pass -std=c++98 to the compiler used in building 
stage 1.  Does this seem like the right way to do that?

Tested x86_64-pc-linux-gnu.

[-- Attachment #2: s1-98.patch --]
[-- Type: text/x-patch, Size: 1855 bytes --]

commit 97e77ef17e558cdb6d26d440e691fea710e2a2dc
Author: Jason Merrill <jason@redhat.com>
Date:   Mon May 18 23:58:41 2015 -0400

    	* configure.ac: Add -std=c++98 to stage1_cxxflags.
    	* Makefile.in (STAGE1_CXXFLAGS): And substitute it.
    	* configure: Regenerate.

diff --git a/Makefile.in b/Makefile.in
index c221a0b..c59671a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -489,6 +489,7 @@ STAGEfeedback_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 # overrideable (for a bootstrap build stage1 also builds gcc.info).
 
 STAGE1_CFLAGS = @stage1_cflags@
+STAGE1_CXXFLAGS = @stage1_cxxflags@
 STAGE1_CHECKING = @stage1_checking@
 STAGE1_LANGUAGES = @stage1_languages@
 # * We force-disable intermodule optimizations, even if
diff --git a/configure b/configure
index d804329..37079fb 100755
--- a/configure
+++ b/configure
@@ -559,6 +559,7 @@ compare_exclusions
 host_shared
 stage2_werror_flag
 stage1_checking
+stage1_cxxflags
 stage1_cflags
 MAINT
 MAINTAINER_MODE_FALSE
@@ -14755,6 +14756,13 @@ case $build in
       *) stage1_cflags="-g -J" ;;
     esac ;;
 esac
+stage1_cxxflags="$stage1_cflags"
+if test "$GCC" = yes; then
+  # Build stage 1 in C++98 mode to ensure that a C++98 compiler can still
+  # start the bootstrap.
+  stage1_cxxflags="$stage1_cxxflags -std=c++98"
+fi
+
 
 
 
diff --git a/configure.ac b/configure.ac
index 4da04b7..2bf3245 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3476,8 +3476,15 @@ case $build in
       *) stage1_cflags="-g -J" ;;
     esac ;;
 esac
+stage1_cxxflags="$stage1_cflags"
+if test "$GCC" = yes; then
+  # Build stage 1 in C++98 mode to ensure that a C++98 compiler can still
+  # start the bootstrap.
+  stage1_cxxflags="$stage1_cxxflags -std=c++98"
+fi
 
 AC_SUBST(stage1_cflags)
+AC_SUBST(stage1_cxxflags)
 
 # Enable --enable-checking in stage1 of the compiler.
 AC_ARG_ENABLE(stage1-checking,

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

* Re: RFA: PATCH to use -std=c++98 in stage 1 of bootstrap
  2015-05-20 17:27 RFA: PATCH to use -std=c++98 in stage 1 of bootstrap Jason Merrill
@ 2015-05-20 22:16 ` Alexandre Oliva
  2015-05-21 15:11   ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2015-05-20 22:16 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List

On May 20, 2015, Jason Merrill <jason@redhat.com> wrote:

> I want to explicitly pass -std=c++98 to the compiler used in building
> stage 1.  Does this seem like the right way to do that?

It certainly works, but I'm a bit concerned about its overriding the
earlier choices of STAGE1_CXXFLAGS, that use CXXFLAGS or STAGE1_CFLAGS
depending on whether or not C++ is being bootstrapped.  Now, since GCC
is in C++ nowadays, not bootstrapping C++ is not really possible, so it
seems to make sense to just drop it.  The top-level is shared with other
projects written in C++, but this change would only impact them if they
involved bootstrapping too, which AFAIK only GCC does.

The only serious problem with the patch is that it changes Makefile.in,
but not the corresponding part of Makefile.tpl from which it is
generated.  Ok with that change.

Now, if you'd also update the comments just before it, that still
suggest we build only C in stage1, that would be appreciated.

Thanks,

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer

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

* Re: RFA: PATCH to use -std=c++98 in stage 1 of bootstrap
  2015-05-20 22:16 ` Alexandre Oliva
@ 2015-05-21 15:11   ` Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2015-05-21 15:11 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches List

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

On 05/20/2015 06:11 PM, Alexandre Oliva wrote:
> The only serious problem with the patch is that it changes Makefile.in,
> but not the corresponding part of Makefile.tpl from which it is
> generated.  Ok with that change.
>
> Now, if you'd also update the comments just before it, that still
> suggest we build only C in stage1, that would be appreciated.

Sure, here's what I'm applying.



[-- Attachment #2: s1-98.patch --]
[-- Type: text/x-patch, Size: 4652 bytes --]

commit 09fbb5f79eae1e95ce64b0f746e9085567e86fbf
Author: Jason Merrill <jason@redhat.com>
Date:   Mon May 18 23:58:41 2015 -0400

    	* configure.ac: Add -std=c++98 to stage1_cxxflags.
    	* Makefile.tpl (STAGE1_CXXFLAGS): And substitute it.
    	* Makefile.in, configure: Regenerate.

diff --git a/Makefile.in b/Makefile.in
index c221a0b..7ae2a40 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -482,13 +482,12 @@ STAGEfeedback_TFLAGS = $(STAGE_TFLAGS)
 STAGEfeedback_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 
 
-# Only build the C compiler for stage1, because that is the only one that
-# we can guarantee will build with the native compiler, and also it is the
-# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
-# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
-# overrideable (for a bootstrap build stage1 also builds gcc.info).
+# By default, C and C++ are the only stage1 languages, because they are the
+# only ones we require to build with the bootstrap compiler, and also the
+# only ones useful for building stage2.
 
 STAGE1_CFLAGS = @stage1_cflags@
+STAGE1_CXXFLAGS = @stage1_cxxflags@
 STAGE1_CHECKING = @stage1_checking@
 STAGE1_LANGUAGES = @stage1_languages@
 # * We force-disable intermodule optimizations, even if
@@ -677,7 +676,9 @@ CXX_FOR_TARGET_FLAG_TO_PASS = \
 	$(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
 @endif target-libstdc++-v3
 
-# Flags to pass down to all sub-makes.
+# Flags to pass down to all sub-makes. STAGE*FLAGS,
+# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
+# overrideable (for a bootstrap build stage1 also builds gcc.info).
 BASE_FLAGS_TO_PASS = \
 	"DESTDIR=$(DESTDIR)" \
 	"RPATH_ENVVAR=$(RPATH_ENVVAR)" \
diff --git a/Makefile.tpl b/Makefile.tpl
index ec53b59..914196f 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -435,13 +435,12 @@ STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
 [+ ENDFOR bootstrap-stage +]
 
-# Only build the C compiler for stage1, because that is the only one that
-# we can guarantee will build with the native compiler, and also it is the
-# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
-# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
-# overrideable (for a bootstrap build stage1 also builds gcc.info).
+# By default, C and C++ are the only stage1 languages, because they are the
+# only ones we require to build with the bootstrap compiler, and also the
+# only ones useful for building stage2.
 
 STAGE1_CFLAGS = @stage1_cflags@
+STAGE1_CXXFLAGS = @stage1_cxxflags@
 STAGE1_CHECKING = @stage1_checking@
 STAGE1_LANGUAGES = @stage1_languages@
 # * We force-disable intermodule optimizations, even if
@@ -579,7 +578,9 @@ CXX_FOR_TARGET_FLAG_TO_PASS = \
 	$(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
 @endif target-libstdc++-v3
 
-# Flags to pass down to all sub-makes.
+# Flags to pass down to all sub-makes. STAGE*FLAGS,
+# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
+# overrideable (for a bootstrap build stage1 also builds gcc.info).
 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
 	"`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
 	"[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
diff --git a/configure b/configure
index d804329..07aba3e 100755
--- a/configure
+++ b/configure
@@ -559,6 +559,7 @@ compare_exclusions
 host_shared
 stage2_werror_flag
 stage1_checking
+stage1_cxxflags
 stage1_cflags
 MAINT
 MAINTAINER_MODE_FALSE
@@ -14755,6 +14756,13 @@ case $build in
       *) stage1_cflags="-g -J" ;;
     esac ;;
 esac
+stage1_cxxflags='$(STAGE1_CFLAGS)'
+if test "$GCC" = yes; then
+  # Build stage 1 in C++98 mode to ensure that a C++98 compiler can still
+  # start the bootstrap.
+  stage1_cxxflags="$stage1_cxxflags -std=c++98"
+fi
+
 
 
 
diff --git a/configure.ac b/configure.ac
index 4da04b7..5808eda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3476,8 +3476,15 @@ case $build in
       *) stage1_cflags="-g -J" ;;
     esac ;;
 esac
+stage1_cxxflags='$(STAGE1_CFLAGS)'
+if test "$GCC" = yes; then
+  # Build stage 1 in C++98 mode to ensure that a C++98 compiler can still
+  # start the bootstrap.
+  stage1_cxxflags="$stage1_cxxflags -std=c++98"
+fi
 
 AC_SUBST(stage1_cflags)
+AC_SUBST(stage1_cxxflags)
 
 # Enable --enable-checking in stage1 of the compiler.
 AC_ARG_ENABLE(stage1-checking,

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

end of thread, other threads:[~2015-05-21 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 17:27 RFA: PATCH to use -std=c++98 in stage 1 of bootstrap Jason Merrill
2015-05-20 22:16 ` Alexandre Oliva
2015-05-21 15:11   ` Jason Merrill

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