Hi,

The pch-init leaves check objects lying around, remove them.

While at it, i noticed that i was getting warnings from the check since
it was invoced with xg++ -nostdinc++ on C source (in one of the two
iterations the check is run -- once per tool).
My suggestion is to use the correct tool to perform the pch check. Does
that make sense to you?

Regstrapped (together with the auto-removal patch just sent) on
x86_64-unknown-linux-gnu with trunk@204119 without regressions.

Ok for trunk?

gcc/testsuite/ChangeLog

2013-10-12  Bernhard Reutner-Fischer  <al...@gcc.gnu.org>

        * lib/dg-pch.exp (pch-init): Remove pchtest check objects.
        Compile pchtest with current tool.
diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp
index d82c669..41de454 100644
--- a/gcc/testsuite/lib/dg-pch.exp
+++ b/gcc/testsuite/lib/dg-pch.exp
@@ -18,6 +18,18 @@ load_lib copy-file.exp
 
 proc pch-init { args } {
     global pch_unsupported_debug pch_unsupported
+    global tool
+
+    set chk_content ""
+    set chk_lang "c-header"
+    switch -- "$tool" {
+	"g++" {
+		set chk_content "// C++"
+		set chk_lang "c++-header"
+	      }
+    }
+    append chk_content "\nint i;"
+    set chk_lang "-x $chk_lang"
 
     if [info exists pch_unsupported_debug] {
 	error "pch-init: pch_unsupported_debug is not empty as expected"
@@ -26,20 +38,22 @@ proc pch-init { args } {
 	error "pch-init: pch_unsupported is not empty as expected"
     }
 
-    set result [check_compile pchtest object "int i;" "-g -x c-header"]
+    set result [check_compile pchtest object "$chk_content" "-g $chk_lang"]
     set pch_unsupported_debug \
 	[regexp "debug format cannot be used with pre-compiled headers" \
 		[lindex $result 0]]
+    remove-build-file [lindex $result 1]
 
     set pch_unsupported 0
     if { $pch_unsupported_debug } {
 	verbose -log "pch is unsupported with the debug info format"
 
-	set result [check_compile pchtest object "int i;" "-x c-header"]
+	set result [check_compile pchtest object "$chk_type" "$chk_lang"]
 	    set pch_unsupported \
 		[regexp "debug format cannot be used with pre-compiled headers" \
 			[lindex $result 0]]
     }
+    remove-build-file [lindex $result 1]
 }
 
 proc pch-finish { args } {

Reply via email to