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]

RFA: Another installed-tree testing patch


This is another patch for installed-tree testing using
v3_target_compile_as_c.  The directories we're searching for C++ files
(when using the C compiler) need to include
$target/include/c++/$version, for a cross compiler.

As I've noted in the comment, this is all an ugly hack; the right
answer is for the compiler to have a -print-include-dirs option that
we could pass to g++, and then just include that list for the C
compiler.  But, we don't have that.

Tested with a cross to arm-eabi.  OK to apply?

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2007-05-07  Mark Mitchell  <mark@codesourcery.com>

	* testsuite/lib/libstdc++.exp (v3_target_compile_as_c): For
	installed-tree testing, search more include directories.

Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 124505)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(working copy)
@@ -398,6 +398,9 @@ proc v3_target_compile_as_c { source des
     # the includes variable is not likely to include the necessary
     # info.
     if { ![file exists $flags_file] } {
+	# ??? We need a --print-include-dirs option to GCC, so that
+	# we can avoid these hacks.  The heuristics here will not
+	# work with non-standard --with-includedir= options.
 	set version [remote_exec host ${cc} -dumpversion]
 	# Remove the trailing newline from the output.
 	set version [string trimright [lindex $version 1]]
@@ -406,6 +409,13 @@ proc v3_target_compile_as_c { source des
 	set comp_base_dir [remote_exec host ${cc} --print-prog-name=cc1]
 	set comp_base_dir [lindex $comp_base_dir 1]
 	set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname $comp_base_dir]]]]]
+	# For a cross compiler, the header files will be located in a
+	# machine-specific subdirectory.
+	set crossbase "${comp_base_dir}/${machine}/include/c++/${version}"
+	set crosstarget "${crossbase}/${machine}"
+	set cc_final [concat $cc_final "-I$crossbase -I$crosstarget"]
+	# For a native compiler, the header files will be located at 
+	# the top level.
 	set includesbase "${comp_base_dir}/include/c++/${version}"
 	set includestarget "${includesbase}/${machine}"
 	set cc_final [concat $cc_final "-I$includesbase -I$includestarget"]


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