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]

PATCH: Install two PCH files instead of one


In article <20030416225240 dot 1a457034 dot bkoz at redhat dot com>,
Benjamin Kosnik<bkoz at redhat dot com> writes:

>> echo '#error Failure to use PCH file as requested.' > ${pch_input}; \

> I guess my use of pch_input is unclear.[...]
> Note that ${pch_input} isn't installed, and on purpose.[...]

OK, the first version you posted had installed both stdc++.h and
stdc++.h.gch (recall: that is the only one I actually looked at in
great detail before posting my patch ;-).  Agreed, let's stick with
your new theory.  See my updated patch.  Ah, I like your new theory.
You get a non-fatal warning about a missing file when you use options
not compatible with any installed PCH:

; time g++ -include stdc++.h -gdwarf -g3 -static -Winvalid-pch -O2 t.C
<internal>:0: warning: support for the DWARF1 debugging format is deprecated
cc1plus: warning: [...].gch/O0g: created with -gdwarf-2, but used with -gdwarf-1
cc1plus: warning: [...].gch/O2g: created with -gdwarf-2, but used with -gdwarf-1
cc1plus: stdc++.h: No such file or directory
     3r     3.4u     0.1s       g++ [...]
; time g++ -include stdc++.h -g -static -Winvalid-pch -O2 t.C
cc1plus: warning: [...].gch/O0g: not used because `__NO_INLINE__' not defined
     1r     1.1u     0.3s       g++ [...]

Also, additional play reveals that we only need to build and install
two PCH files for the typical system (if linux really does something
macro-related with -pthread, then perhaps four would be in order
there; FreeBSD does nothing with that switch until link time since
someone cleaned our system headers of the dreaded _REENTRANT flag).
PCH automatically handles -g -> -g0 gracefully.  It can't handle
-g0 -> -g.  I figured this out empirically; not explicitly documented.
As noted above in the warning text, it can't handle -g[dwarf-2] ->
-g[dwarf-1], etc.

Benjamin/Geoff, I think I also now know why Benjamin doesn't see any
fails in libstdc++-v3 (even though he too has dwarf-2 on linux,
right?).  They are non-deterministic w.r.t. available memory...
Given the machine Benjamin has compared to this one...

>> I have a patch from Geoff (only required for dwarf2 machines)[...]

> Any chance these could go in as you find them?

Well, that patch is not my call.  Agreed, incremental fixing is good.
What I have in my tree clearly fixes some outstanding PCH failures
without adding new failures.

Benjamin, as the "owner" of the PCH enablement bits, OK?

Regards,
Loren

	* include/Makefile.am (pch_output): Rename to pch_output_builddir.
	(pch_build): Key off a file.
	(pch_output rule): Rename to...
	(pch_input rule): ...this.  Produce ${pch_output_builddir}
	instead of ${pch_output}.
	(install-pch rule): Install ${pch_output_builddir}.
	* include/Makefile.in: Regenerated.

(Note that pch_build had to be redirected to point to a file.
 pch_input is now being used like a stamp file.)

Index: libstdc++-v3/include/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/Makefile.am,v
retrieving revision 1.55
diff -c -r1.55 Makefile.am
*** libstdc++-v3/include/Makefile.am	17 Apr 2003 03:27:05 -0000	1.55
--- libstdc++-v3/include/Makefile.am	17 Apr 2003 06:37:25 -0000
***************
*** 341,351 ****
  	${target_builddir}/gthr-default.h
  
  pch_input = stdc++.h
! pch_output = stdc++.h.gch
  pch_source = ${glibcpp_srcdir}/include/${pch_input}
  PCHFLAGS=-Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
  if GLIBCPP_BUILD_PCH
! pch_build = ${pch_output}
  pch_install = install-pch
  else
  pch_build = 
--- 341,351 ----
  	${target_builddir}/gthr-default.h
  
  pch_input = stdc++.h
! pch_output_builddir = stdc++.h.gch
  pch_source = ${glibcpp_srcdir}/include/${pch_input}
  PCHFLAGS=-Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
  if GLIBCPP_BUILD_PCH
! pch_build = ${pch_input}
  pch_install = install-pch
  else
  pch_build = 
***************
*** 500,508 ****
  	    < ${toplevel_srcdir}/gcc/${glibcpp_thread_h} > $@
  
  # Build a precompiled C++ include, stdc++.h.gch.
! ${pch_output}: ${allstamped} ${target_builddir}/c++config.h ${pch_source}
  	touch ${pch_input}; \
! 	$(CXX) $(PCHFLAGS) $(INCLUDES) ${pch_source} -o ${pch_output}; 
  
  # For robustness sake (in light of junk files or in-source
  # configuration), copy from the build or source tree to the install
--- 500,512 ----
  	    < ${toplevel_srcdir}/gcc/${glibcpp_thread_h} > $@
  
  # Build a precompiled C++ include, stdc++.h.gch.
! ${pch_input}: ${allstamped} ${target_builddir}/c++config.h ${pch_source}
  	touch ${pch_input}; \
! 	if [ ! -d "${pch_output_builddir}" ]; then \
! 	  mkdir -p ${pch_output_builddir}; \
! 	fi; \
! 	$(CXX) $(PCHFLAGS) $(INCLUDES) ${pch_source} -O0 -g -o ${pch_output_builddir}/O0g; \
! 	$(CXX) $(PCHFLAGS) $(INCLUDES) ${pch_source} -O2 -g -o ${pch_output_builddir}/O2g;
  
  # For robustness sake (in light of junk files or in-source
  # configuration), copy from the build or source tree to the install
***************
*** 545,551 ****
  	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${target_builddir}; done
  
  install-pch:
! 	$(INSTALL_DATA) ${std_builddir}/${pch_output} $(DESTDIR)${gxx_include_dir}/${std_builddir}
  
  # By adding these files here, automake will remove them for 'make clean'
  CLEANFILES = *.gch 
--- 549,557 ----
  	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${target_builddir}; done
  
  install-pch:
! 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${pch_output_builddir}
! 	for file in ${pch_output_builddir}/*; do \
! 	  $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}/${pch_output_builddir}; done
  
  # By adding these files here, automake will remove them for 'make clean'
  CLEANFILES = *.gch 


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