This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

[pch] generate standard C++ headers as PCH


This post is for archiving purposes only. It's not currently in a form
that I would check in.

Instead, this is a quick way to experiment with the status of PCH +
g++ + libstdc+++. What it does is generate 

vector.pch
iostream.pch

etc. 

in the build/include/ directory, so that the compiler will use the
.pch files instead of the normal includes. By doing this, preliminary
benchmarks for pch speedups can be established. It does a separate pch
for each standard header just because it's easy to do in Makefile
syntax, and doesn't require changes to the library itself.

I'm posting it here, and now, so that it doesn't get lost within my
tens of source trees of partially-finished patches.

-benjamin


Index: include/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/Makefile.am,v
retrieving revision 1.49
diff -c -p -r1.49 Makefile.am
*** include/Makefile.am	24 Jan 2003 16:32:11 -0000	1.49
--- include/Makefile.am	4 Feb 2003 23:59:33 -0000
*************** CXX = @glibcpp_CXX@
*** 31,36 ****
--- 31,101 ----
  glibcpp_srcdir=@glibcpp_srcdir@
  glibcpp_builddir=@glibcpp_builddir@
  
+ # Standard C++ includes.
+ std_srcdir = ${glibcpp_srcdir}/include/std
+ std_builddir = .
+ std_headers = \
+ 	${std_srcdir}/std_algorithm.h \
+ 	${std_srcdir}/std_bitset.h \
+ 	${std_srcdir}/std_complex.h \
+ 	${std_srcdir}/std_deque.h \
+ 	${std_srcdir}/std_fstream.h \
+ 	${std_srcdir}/std_functional.h \
+ 	${std_srcdir}/std_iomanip.h \
+ 	${std_srcdir}/std_ios.h \
+ 	${std_srcdir}/std_iosfwd.h \
+ 	${std_srcdir}/std_iostream.h \
+ 	${std_srcdir}/std_istream.h \
+ 	${std_srcdir}/std_iterator.h \
+ 	${std_srcdir}/std_limits.h \
+ 	${std_srcdir}/std_list.h \
+ 	${std_srcdir}/std_locale.h \
+ 	${std_srcdir}/std_map.h \
+ 	${std_srcdir}/std_memory.h \
+ 	${std_srcdir}/std_numeric.h \
+ 	${std_srcdir}/std_ostream.h \
+ 	${std_srcdir}/std_queue.h \
+ 	${std_srcdir}/std_set.h \
+ 	${std_srcdir}/std_sstream.h \
+ 	${std_srcdir}/std_stack.h \
+ 	${std_srcdir}/std_stdexcept.h \
+ 	${std_srcdir}/std_streambuf.h \
+ 	${std_srcdir}/std_string.h \
+ 	${std_srcdir}/std_utility.h \
+ 	${std_srcdir}/std_valarray.h \
+ 	${std_srcdir}/std_vector.h
+ # Renamed at build time. 
+ std_headers_rename = \
+ 	algorithm \
+ 	bitset \
+ 	complex \
+ 	deque \
+ 	fstream \
+ 	functional \
+ 	iomanip \
+ 	ios \
+ 	iosfwd \
+ 	iostream \
+ 	istream \
+ 	iterator \
+ 	limits \
+ 	list \
+ 	locale \
+ 	map \
+ 	memory \
+ 	numeric \
+ 	ostream \
+ 	queue \
+ 	set \
+ 	sstream \
+ 	stack \
+ 	stdexcept \
+ 	streambuf \
+ 	string \
+ 	utility \
+ 	valarray \
+ 	vector
+ 
  bits_srcdir = ${glibcpp_srcdir}/include/bits
  bits_builddir = ./bits
  bits_headers = \
*************** else
*** 241,311 ****
  c_compatibility_headers_extra = 
  endif
  
- 
- std_srcdir = ${glibcpp_srcdir}/include/std
- std_builddir = .
- std_headers = \
- 	${std_srcdir}/std_algorithm.h \
- 	${std_srcdir}/std_bitset.h \
- 	${std_srcdir}/std_complex.h \
- 	${std_srcdir}/std_deque.h \
- 	${std_srcdir}/std_fstream.h \
- 	${std_srcdir}/std_functional.h \
- 	${std_srcdir}/std_iomanip.h \
- 	${std_srcdir}/std_ios.h \
- 	${std_srcdir}/std_iosfwd.h \
- 	${std_srcdir}/std_iostream.h \
- 	${std_srcdir}/std_istream.h \
- 	${std_srcdir}/std_iterator.h \
- 	${std_srcdir}/std_limits.h \
- 	${std_srcdir}/std_list.h \
- 	${std_srcdir}/std_locale.h \
- 	${std_srcdir}/std_map.h \
- 	${std_srcdir}/std_memory.h \
- 	${std_srcdir}/std_numeric.h \
- 	${std_srcdir}/std_ostream.h \
- 	${std_srcdir}/std_queue.h \
- 	${std_srcdir}/std_set.h \
- 	${std_srcdir}/std_sstream.h \
- 	${std_srcdir}/std_stack.h \
- 	${std_srcdir}/std_stdexcept.h \
- 	${std_srcdir}/std_streambuf.h \
- 	${std_srcdir}/std_string.h \
- 	${std_srcdir}/std_utility.h \
- 	${std_srcdir}/std_valarray.h \
- 	${std_srcdir}/std_vector.h
- # Renamed at build time. 
- std_headers_rename = \
- 	algorithm \
- 	bitset \
- 	complex \
- 	deque \
- 	fstream \
- 	functional \
- 	iomanip \
- 	ios \
- 	iosfwd \
- 	iostream \
- 	istream \
- 	iterator \
- 	limits \
- 	list \
- 	locale \
- 	map \
- 	memory \
- 	numeric \
- 	ostream \
- 	queue \
- 	set \
- 	sstream \
- 	stack \
- 	stdexcept \
- 	streambuf \
- 	string \
- 	utility \
- 	valarray \
- 	vector
- 
  target_srcdir = ${glibcpp_srcdir}/@OS_INC_SRCDIR@
  target_builddir = ./${target_alias}/bits
  target_headers = \
--- 306,311 ----
*************** thread_target_headers = \
*** 339,345 ****
  # CLEANFILES and all-local are kept up-to-date.
  allstamps = \
  	stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
! 	stamp-backward stamp-ext stamp-target
  
  
  # Here are the rules for building the headers
--- 339,345 ----
  # CLEANFILES and all-local are kept up-to-date.
  allstamps = \
  	stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
! 	stamp-backward stamp-ext stamp-target stamp-std-precompile
  
  
  # Here are the rules for building the headers
*************** stamp-std: ${std_headers}
*** 359,364 ****
--- 359,378 ----
  	  echo `date` > stamp-std ;\
  	fi
  
+ GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
+ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
+ INCLUDES = -nostdinc++ $(GLIBCPP_INCLUDES) $(LIBSUPCXX_INCLUDES)
+ 
+ CXX_PRECOMPILE = @glibcpp_CXX@ $(INCLUDES) -Winvalid-pch
+ 
+ stamp-std-precompile: stamp-std
+ 	for h in ${std_headers_rename}; do \
+ 	  compilef=`echo precomp_$$h.hh`; \
+ 	  echo "#include<$${h}>" > $${compilef}; \
+ 	  $(CXX_PRECOMPILE) $${compilef} -o ./$${h}.pch; \
+ 	done; \
+ 	echo `date` > stamp-std-precompile
+ 
  stamp-bits: ${bits_headers}
  	@if [ ! -d "${bits_builddir}" ]; then \
  	  mkdir -p ${bits_builddir} ;\
*************** install-data-local:
*** 514,520 ****
  	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${target_builddir}; done
  
  # By adding these files here, automake will remove them for 'make clean'
! #CLEANFILES = ${allstamps} 
  
  # Stop implicit '.o' make rules from ever stomping on extensionless
  # headers, in the improbable case where some foolish, crack-addled
--- 528,534 ----
  	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${target_builddir}; done
  
  # By adding these files here, automake will remove them for 'make clean'
! CLEANFILES = *.cc *.pch stamp-std-precompile
  
  # Stop implicit '.o' make rules from ever stomping on extensionless
  # headers, in the improbable case where some foolish, crack-addled


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