Hi,

On Thu, 3 Nov 2011, Eric Botcazou wrote:

> > There is a bug about not using -fexceptions (50857).
> 
> Then let's fix it, as you said there "We fail to pass -fno-exceptions 
> -fno-rtti to g++ for stage2 and stage3 building the host binaries.  
> That leads to increased compile-time and possibly runtime."

This follows Ians suggestion from PR50857, testing in libcpp/ and gcc/ if 
-fno-exceptions and -fno-rtti work with the compiler, and add them to 
ALL_CXXFLAGS.  It does fix bootstrap with c,c++,ada and my patch.  No yet 
put through an all-language bootstrap of testsuite.  What do you think?
(I also looked at doing this from top-level configure/Makefile/whatever, 
but that's too complicated for me it seems).


Ciao,
Michael.

libcpp/
        * configure.ac: Check for -fno-exceptions -fno-rtti.
        * configure: Regenerate.
        * Makefile.in (NOEXCEPTION_FLAGS): New flag.
        (ALL_CXXFLAGS): Use it.

gcc/
        * configure.ac: Check for -fno-exceptions -fno-rtti.
        * configure: Regenerate.
        * Makefile.in (NOEXCEPTION_FLAGS): New flag.
        (ALL_CXXFLAGS): Use it.
        
Index: libcpp/configure.ac
===================================================================
--- libcpp/configure.ac (revision 180700)
+++ libcpp/configure.ac (working copy)
@@ -39,6 +39,10 @@ ACX_PROG_CC_WARNING_OPTS([-Wstrict-proto
                          -Wold-style-definition -Wc++-compat], [c_warn])
 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
 
+# Disable exceptions and RTTI if building with g++
+ACX_PROG_CC_WARNING_OPTS(
+       m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
+
 # Only enable with --enable-werror-always until existing warnings are
 # corrected.
 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
Index: libcpp/Makefile.in
===================================================================
--- libcpp/Makefile.in  (revision 180700)
+++ libcpp/Makefile.in  (working copy)
@@ -56,6 +56,7 @@ XGETTEXT = @XGETTEXT@
 CCDEPMODE = @CCDEPMODE@
 CXXDEPMODE = @CXXDEPMODE@
 DEPDIR = @DEPDIR@
+NOEXCEPTION_FLAGS = @noexception_flags@
 
 datarootdir = @datarootdir@
 datadir = @datadir@
@@ -72,7 +73,8 @@ INCLUDES = -I$(srcdir) -I. -I$(srcdir)/.
        -I$(srcdir)/include
 
 ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
-ALL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(INCLUDES) $(CPPFLAGS)
+ALL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(NOEXCEPTION_FLAGS) $(INCLUDES) \
+       $(CPPFLAGS)
 
 # The name of the compiler to use.
 ENABLE_BUILD_WITH_CXX = @ENABLE_BUILD_WITH_CXX@
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac    (revision 180700)
+++ gcc/configure.ac    (working copy)
@@ -357,6 +357,10 @@ fi
 AC_SUBST(warn_cflags)
 AC_SUBST(warn_cxxflags)
 
+# Disable exceptions and RTTI if building with g++
+ACX_PROG_CC_WARNING_OPTS(
+       m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
+       
 # Enable expensive internal checks
 is_release=
 if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in     (revision 180700)
+++ gcc/Makefile.in     (working copy)
@@ -164,6 +164,8 @@ C_STRICT_WARN = @c_strict_warn@
 # "extern" tags in header files.
 NOCOMMON_FLAG = @nocommon_flag@
 
+NOEXCEPTION_FLAGS = @noexception_flags@
+
 # This is set by --disable-maintainer-mode (default) to "#"
 # FIXME: 'MAINT' will always be set to an empty string, no matter if
 # --disable-maintainer-mode is used or not.  This is because the
@@ -1033,7 +1035,7 @@ ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
 
 # The C++ version.
 ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
-  $(COVERAGE_FLAGS) $(WARN_CXXFLAGS) @DEFS@
+  $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
 
 # Likewise.  Put INCLUDES at the beginning: this way, if some autoconf macro
 # puts -I options in CPPFLAGS, our include files in the srcdir will always

Reply via email to