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]

PATCH: Correct v3_target_compile_as_c for installed-tree testing


I recently checked in a change to <cxxabi.h> which Paolo C. recognized
as causing a failure in the test that checks to see if <cxxabi.h> can
be used from C code.  I wanted to understand why I hadn't seen that
failure.  The problem was that the testsuite got an error before
running that test due to bugs in the handling of installed-tree
testing (which is what I was using) in v3_target_compile_as_c.

There were two problems:

1. We were using "remote_exec exec" instead of "remote_exec host".
   There's no such board as "exec" (the valid choices are "build",
   "host", and "target").

2. The "remote_exec" command faithfully captures all output, including
   trailing newlines.  So, when running "gcc -dumpversion" and "gcc
   -dumpmachine", we got trailing newlines, and then construted things
   like "-I /path/to/something\n", which doesn't work.

I have committed this patch as obvious, after testing on
i686-solaris2.10.

[V3 folks, I hope I'm not stepping on any toes here.  I would normally
have given some time for comments, but this seemed so obvious and only
applied to the testsuite.  If you disagree, let me know.]

--
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): In
	installed-tree testing, use "remote_exec host", not "remote_exec
	exec".  Trip trailing newlines from output of -dumpversion and
	-dumpmachine.

Index: libstdc++-v3/testsuite/lib/libstdc++.exp
===================================================================
--- libstdc++-v3/testsuite/lib/libstdc++.exp	(revision 124476)
+++ libstdc++-v3/testsuite/lib/libstdc++.exp	(working copy)
@@ -399,9 +399,10 @@ proc v3_target_compile_as_c { source des
     # info.
     if { ![file exists $flags_file] } {
 	set version [remote_exec host ${cc} -dumpversion]
-	set version [lindex $version 1]
-	set machine [remote_exec exec ${cc} -dumpmachine]
-	set machine [lindex $machine 1]
+	# Remove the trailing newline from the output.
+	set version [string trimright [lindex $version 1]]
+	set machine [remote_exec host ${cc} -dumpmachine]
+	set machine [string trimright [lindex $machine 1]]
 	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]]]]]


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