This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] --enable-pch


Roger was the last in a long line of people who've politely asked me
to do this. 

This allows --disable-pch to turn off attempts to use pre compiled
headers in C++ runtime land, as should have been done from the very
beginning. I'd hoped that the persistent failures with PCH and -fPIC
etc etc would motivate quick patches: this hasn't happened, and it's
unfair to ask people who are trying to keep ports above water to do
hacky things to testsuite_flags.in to work around this. Note, that PCH
is still enabled by default: however, once it's apparent that it's not
working, this flag will allow people to side-step the problem
gracefully.

Recently I've had to move back to pre-PCH g++'s do do debugging, so
this was starting to be a pain in the neck for me as well.

tested x86/linux

2003-06-30  Benjamin Kosnik  <bkoz@redhat.com>
	
	* acinclude.m4 (GLIBCPP_ENABLE_PCH): Add bits for --enable-pch.
	* aclocal.m4: Regenerate.
	* configure.in (GLIBCPP_CHECK_PCH): Move, change to
	GLIBCPP_ENABLE_PCH, default to yes.
	* configure: Regenerate.
	* docs/html/configopts.html: Add --enable-pch.

Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.246
diff -c -p -r1.246 acinclude.m4
*** acinclude.m4	18 Jun 2003 05:09:43 -0000	1.246
--- acinclude.m4	30 Jun 2003 17:31:10 -0000
*************** AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
*** 1371,1402 ****
  dnl
  dnl Check to see if building and using a C++ precompiled header can be done.
  dnl
! dnl GLIBCPP_CHECK_PCH
  dnl
! dnl If it looks like it may work, flip bits on in include/Makefile.am
  dnl
! AC_DEFUN(GLIBCPP_CHECK_PCH, [
!   ac_test_CXXFLAGS="${CXXFLAGS+set}"
!   ac_save_CXXFLAGS="$CXXFLAGS"
!   CXXFLAGS='-Werror -Winvalid-pch -Wno-deprecated -x c++-header'
! 
!   AC_MSG_CHECKING([for compiler that seems to compile .gch files])
!   if test x${glibcpp_pch_comp+set} != xset; then
!     AC_CACHE_VAL(glibcpp_pch_comp, [
!       AC_LANG_SAVE
!       AC_LANG_CPLUSPLUS
!       AC_TRY_COMPILE([#include <math.h>
  		     ],
                       [ $1(0);],
                       [glibcpp_pch_comp=yes], [glibcpp_pch_comp=no])
!       AC_LANG_RESTORE
!     ])
    fi
-   AC_MSG_RESULT([$glibcpp_pch_comp])
  
!   CXXFLAGS="$ac_save_CXXFLAGS"
!   AM_CONDITIONAL(GLIBCPP_BUILD_PCH, test "$glibcpp_pch_comp" = yes)
!   if test "$glibcpp_pch_comp" = yes; then
  	glibcpp_PCHFLAGS="-include bits/stdc++.h"
    else
  	glibcpp_PCHFLAGS=""
--- 1371,1430 ----
  dnl
  dnl Check to see if building and using a C++ precompiled header can be done.
  dnl
! dnl GLIBCPP_ENABLE_PCH
  dnl
! dnl --enable-pch=yes
! dnl default, this shows intent to use stdc++.h.gch If it looks like it
! dnl may work, after some light-hearted attempts to puzzle out compiler
! dnl support, flip bits on in include/Makefile.am
  dnl
! dnl --disable-pch
! dnl turns off attempts to use or build stdc++.h.gch.
! dnl
! AC_DEFUN(GLIBCPP_ENABLE_PCH, [dnl
! define([GLIBCPP_ENABLE_PCH_DEFAULT], ifelse($1,,, $1))dnl
! AC_ARG_ENABLE(pch,
! changequote(<<, >>)dnl
! <<  --enable-pch         build pre-compiled libstdc++ includes [default=>>GLIBCPP_ENABLE_PCH_DEFAULT],
! changequote([, ])dnl
! [case "${enableval}" in
!  yes) enable_pch=yes ;;
!  no)  enable_pch=no ;;
!  *)   AC_MSG_ERROR([Unknown argument to enable/disable PCH]) ;;
!  esac],
! enable_pch=GLIBCPP_ENABLE_PCH_DEFAULT)dnl
! 
!   if test x$enable_pch = xyes; then
!     ac_test_CXXFLAGS="${CXXFLAGS+set}"
!     ac_save_CXXFLAGS="$CXXFLAGS"
!     CXXFLAGS='-Werror -Winvalid-pch -Wno-deprecated -x c++-header'
! 
!     AC_MSG_CHECKING([for compiler that seems to compile .gch files])
!     if test x${glibcpp_pch_comp+set} != xset; then
!       AC_CACHE_VAL(glibcpp_pch_comp, [
!         AC_LANG_SAVE
!         AC_LANG_CPLUSPLUS
!         AC_TRY_COMPILE([#include <math.h>
  		     ],
                       [ $1(0);],
                       [glibcpp_pch_comp=yes], [glibcpp_pch_comp=no])
!         AC_LANG_RESTORE
!       ])
!     fi
!     AC_MSG_RESULT([$glibcpp_pch_comp])
! 
!     CXXFLAGS="$ac_save_CXXFLAGS"
    fi
  
!   if test x"$enable_pch" = xyes && test x"$glibcpp_pch_comp" = xno; then
!     enable_pch=no
!   fi
! 
!   AC_MSG_CHECKING([for enabled PCH])
!   AC_MSG_RESULT([$enable_pch])
! 
!   AM_CONDITIONAL(GLIBCPP_BUILD_PCH, test "$enable_pch" = yes)
!   if test "$enable_pch" = yes; then
  	glibcpp_PCHFLAGS="-include bits/stdc++.h"
    else
  	glibcpp_PCHFLAGS=""
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.133
diff -c -p -r1.133 configure.in
*** configure.in	19 Jun 2003 19:53:57 -0000	1.133
--- configure.in	30 Jun 2003 17:31:10 -0000
*************** AM_PROG_LIBTOOL
*** 45,56 ****
  AC_SUBST(enable_shared)
  AC_SUBST(enable_static)
  
! # Check for c++ or library specific bits that don't require linking.
  GLIBCPP_CHECK_GNU_MAKE
  #GLIBCPP_CHECK_COMPILER_VERSION
! GLIBCPP_CHECK_PCH
  
! # Enable all the variable C++ stuff.  C_MBCHAR must come early.
  GLIBCPP_ENABLE_CSTDIO
  GLIBCPP_ENABLE_CLOCALE
  GLIBCPP_ENABLE_CHEADERS([$c_model])
--- 45,59 ----
  AC_SUBST(enable_shared)
  AC_SUBST(enable_static)
  
! # Check for support bits and g++ features that don't require linking.
  GLIBCPP_CHECK_GNU_MAKE
  #GLIBCPP_CHECK_COMPILER_VERSION
! GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
! GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
! GLIBCPP_ENABLE_PCH([yes])
  
! # Enable all the variable C++ runtime options.  
! # NB: C_MBCHAR must come early.
  GLIBCPP_ENABLE_CSTDIO
  GLIBCPP_ENABLE_CLOCALE
  GLIBCPP_ENABLE_CHEADERS([$c_model])
*************** GLIBCPP_ENABLE_C_MBCHAR([yes])
*** 58,65 ****
  GLIBCPP_ENABLE_C99([yes])
  GLIBCPP_ENABLE_LONG_LONG([yes])
  GLIBCPP_ENABLE_THREADS
- GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
- GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
  GLIBCPP_ENABLE_CONCEPT_CHECKS
  GLIBCPP_ENABLE_CXX_FLAGS
  GLIBCPP_ENABLE_DEBUG([no])
--- 61,66 ----
Index: docs/html/configopts.html
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/configopts.html,v
retrieving revision 1.29
diff -c -p -r1.29 configopts.html
*** docs/html/configopts.html	12 Jun 2003 03:24:13 -0000	1.29
--- docs/html/configopts.html	30 Jun 2003 17:31:10 -0000
*************** options</a></h1>
*** 261,266 ****
--- 261,278 ----
          people will volunteer to do other 'style' options.
       </p>
   </dd>
+ 
+  <dt><code>--enable-pch  </code></dt>
+  <dd><p>In 3.4 and later, tries to turn on the generation of
+         stdc++.h.gch, a pre-compiled file including all the standard
+         C++ includes. If enabled (as by default), and the compiler
+         seems capable of passing the simple sanity checks thrown at
+         it, try to build stdc++.h.gch as part of the make process. 
+         In addition, this generated file is used later on (by appending <code>
+         --include bits/stdc++.h </code> to CXXFLAGS) when running the
+         testsuite.
+      </p>
+  </dd>
  </dl>
  <p>Return <a href="#top">to the top of the page</a> or
     <a href="http://gcc.gnu.org/libstdc++/";>to the libstdc++ homepage</a>.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]