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] auto-wipe dump files, part1, manual stuff


Ontop of this patch you would have to

git grep -l -E "(cleanup-.*-dump|cleanup-saved-temps)" \
  | egrep -v "(ChangeLog|/lib/)" \
  | sed -e "s|[^/]*$||" | sort | uniq \
  | while read d;
do
  find $d -type f -exec \
    sed -i -e "/cleanup-[^-]*[-]*dump/d;/cleanup-saved-temps/d" {} +
done
---

I had to add dg-keep-saved-temps for the following two testcases:
g++.dg/pch/pch.C gcc.dg/pch/save-temps-1.c

The following testcases had
/* { dg-final { cleanup-saved-temps "ivopts" } } */
resp cleanup-saved-temps "pr43597" or "[dt][fi]mode_off"
which does nothing AFAICT and thus will be removed by above sed.
gcc.target/arm/ivopts-2.c
gcc.target/arm/ivopts-3.c
gcc.target/arm/ivopts-4.c
gcc.target/arm/ivopts-5.c
gcc.target/arm/ivopts.c
gcc.target/arm/pr43597.c
gcc.target/powerpc/dfmode_off.c
gcc.target/powerpc/dimode_off.c
gcc.target/powerpc/tfmode_off.c
gcc.target/powerpc/timode_off.c

I do expect fallout for a couple of days when people push new testcases
and don't have picked up the removal of the procs in their test-runs just yet.

Since you, Mike, OKed the patch in gcc-5 stage-4 for the next stage1, i will
commit this patch (plus the sed in the same revision) in a couple of
hours.

gcc/testsuite/ChangeLog

2015-05-28  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* lib/gcc-dg.exp (cleanup-ipa-dump, cleanup-rtl-dump,
	cleanup-tree-dump, cleanup-dump, cleanup-saved-temps): Remove.
	Adjust all callers.
	(schedule-cleanups, dg-keep-saved-temps): New proc.
	(gcc-dg-test-1): Schedule cleanups.
	* lib/profopt.exp (profopt-execute): Likewise.
	* g++.dg/cdce3.C: Adjust expected line numbers.
	* gcc.dg/cdce1.c: Likewise.
	* gcc.dg/cdce2.c: Likewise.
	* gcc.dg/strlenopt-22.c: Fix comment delimiter.
	* gcc.dg/strlenopt-24.c: Likewise.
	* gcc.dg/tree-ssa/vrp26.c: Likewise.
	* gcc.dg/tree-ssa/vrp28.c: Likewise.
	* obj-c++.dg/encode-2.mm: Likewise.

libgomp/ChangeLog

2015-05-28  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* testsuite/libgomp.graphite/bounds.c: Adjust for
	cleanup-tree-dump removal.
	* testsuite/libgomp.graphite/force-parallel-1.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-2.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-3.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-4.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-5.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-6.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-7.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-8.c: Likewise.
	* testsuite/libgomp.graphite/force-parallel-9.c: Likewise.
	* testsuite/libgomp.graphite/pr41118.c: Likewise.


gcc/ChangeLog

2015-05-28  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* config/arm/neon-testgen.ml (emit_epilogue): Remove manual call
	to cleanup-saved-temps.

gcc/doc/ChangeLog

2015-05-28  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* doc/sourcebuild.texi (Clean up generated test files): Expand
	introduction.
	(cleanup-ipa-dump, cleanup-rtl-dump, cleanup-tree-dump,
	cleanup-saved-temps): Remove.
	(dg-keep-saved-temps): Document new proc.


 gcc/config/arm/neon-testgen.ml          |    1 -
 gcc/doc/sourcebuild.texi                |   30 +++---
 gcc/testsuite/g++.dg/cdce3.C            |    5 +-
 gcc/testsuite/g++.dg/pch/pch.C          |    3 +-
 gcc/testsuite/gcc.dg/cdce1.c            |    3 +-
 gcc/testsuite/gcc.dg/cdce2.c            |    3 +-
 gcc/testsuite/gcc.dg/pch/save-temps-1.c |    3 +-
 gcc/testsuite/gcc.dg/strlenopt-22.c     |    3 +-
 gcc/testsuite/gcc.dg/strlenopt-24.c     |    3 +-
 gcc/testsuite/gcc.dg/tree-ssa/vrp26.c   |    3 +-
 gcc/testsuite/gcc.dg/tree-ssa/vrp28.c   |    3 +-
 gcc/testsuite/lib/gcc-dg.exp            |  170 +++++++++++++++++++++++--------
 gcc/testsuite/lib/profopt.exp           |    3 +
 gcc/testsuite/obj-c++.dg/encode-2.mm    |    3 +-
 14 files changed, 157 insertions(+), 79 deletions(-)

diff --git a/gcc/config/arm/neon-testgen.ml b/gcc/config/arm/neon-testgen.ml
index 0a2a442..3164ab7 100644
--- a/gcc/config/arm/neon-testgen.ml
+++ b/gcc/config/arm/neon-testgen.ml
@@ -138,7 +138,6 @@ let emit_epilogue chan features regexps =
      else
        ()
     );
-    Printf.fprintf chan "/* { dg-final { cleanup-saved-temps } } */\n"
 
 (* Check a list of C types to determine which ones are pointers and which
    ones are const.  *)
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index c6ef40e..cb41b01 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2210,13 +2210,17 @@ Check branch and/or call counts, in addition to line counts, in
 
 @subsubsection Clean up generated test files
 
+Usually the test-framework removes files that were generated during
+testing. If a testcase, for example, uses any dumping mechanism to
+inspect a passes dump file, the testsuite recognized the dump option
+passed to the tool and schedules a final cleanup to remove these files.
+
+There are, however, following additional cleanup directives that can be
+used to annotate a testcase "manually".
 @table @code
 @item cleanup-coverage-files
 Removes coverage data files generated for this test.
 
-@item cleanup-ipa-dump @var{suffix}
-Removes IPA dump files generated for this test.
-
 @item cleanup-modules "@var{list-of-extra-modules}"
 Removes Fortran module files generated for this test, excluding the
 module names listed in keep-modules.
@@ -2251,21 +2255,23 @@ end module keep2
 ! @{ dg-final @{ keep-modules "" @} @} ! keep all
 @end smallexample
 
+@item dg-keep-saved-temps "@var{list-of-suffixes-not-to-delete}"
+Whitespace separated list of suffixes that should not be deleted
+automatically in a testcase that uses @option{-save-temps}.
+@smallexample
+// @{ dg-options "-save-temps -fpch-preprocess -I." @}
+int main() @{ return 0; @}
+// @{ dg-keep-saved-temps ".s" @} ! just keep assembler file
+// @{ dg-keep-saved-temps ".s" ".i" @} ! ... and .i
+// @{ dg-keep-saved-temps ".ii" ".o" @} ! or just .ii and .o
+@end smallexample
+
 @item cleanup-profile-file
 Removes profiling files generated for this test.
 
 @item cleanup-repo-files
 Removes files generated for this test for @option{-frepo}.
 
-@item cleanup-rtl-dump @var{suffix}
-Removes RTL dump files generated for this test.
-
-@item cleanup-saved-temps
-Removes files for the current test which were kept for @option{-save-temps}.
-
-@item cleanup-tree-dump @var{suffix}
-Removes tree dump files matching @var{suffix} which were generated for
-this test.
 @end table
 
 @node Ada Tests
diff --git a/gcc/testsuite/g++.dg/cdce3.C b/gcc/testsuite/g++.dg/cdce3.C
index 726e9ec..3937953 100644
--- a/gcc/testsuite/g++.dg/cdce3.C
+++ b/gcc/testsuite/g++.dg/cdce3.C
@@ -4,8 +4,9 @@
 /* { dg-additional-options "-DLARGE_LONG_DOUBLE" { target large_long_double } } */
 /* { dg-additional-options "-DGNU_EXTENSION" { target pow10 } } */
 /* { dg-add-options ieee } */
+/* { dg-final { scan-tree-dump  "cdce3.C:91: note: function call is shrink-wrapped into error conditions\." "cdce" { target pow10 } } } */
 /* { dg-final { scan-tree-dump  "cdce3.C:92: note: function call is shrink-wrapped into error conditions\." "cdce" { target pow10 } } } */
-/* { dg-final { scan-tree-dump  "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" { target pow10 } } } */
+/* { dg-final { scan-tree-dump  "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
 /* { dg-final { scan-tree-dump  "cdce3.C:95: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
 /* { dg-final { scan-tree-dump  "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
 /* { dg-final { scan-tree-dump  "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
@@ -19,8 +20,6 @@
 /* { dg-final { scan-tree-dump  "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
 /* { dg-final { scan-tree-dump  "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
 /* { dg-final { scan-tree-dump  "cdce3.C:107: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
-/* { dg-final { scan-tree-dump  "cdce3.C:108: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
-/* { dg-final { cleanup-tree-dump "cdce" } } */
 
 #include <stdlib.h>
 #include <math.h>
diff --git a/gcc/testsuite/g++.dg/pch/pch.C b/gcc/testsuite/g++.dg/pch/pch.C
index 9483efa..74d302e 100644
--- a/gcc/testsuite/g++.dg/pch/pch.C
+++ b/gcc/testsuite/g++.dg/pch/pch.C
@@ -5,5 +5,4 @@ int main()
 {
   return 0;
 }
-
-// { dg-final { cleanup-saved-temps ".s" } }
+// { dg-keep-saved-temps ".s" }
diff --git a/gcc/testsuite/gcc.dg/cdce1.c b/gcc/testsuite/gcc.dg/cdce1.c
index 2123f7f..02b47c0 100644
--- a/gcc/testsuite/gcc.dg/cdce1.c
+++ b/gcc/testsuite/gcc.dg/cdce1.c
@@ -1,8 +1,7 @@
 /* { dg-do  run  } */
 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
 /* { dg-require-effective-target int32plus } */
-/* { dg-final { scan-tree-dump  "cdce1.c:17: note: function call is shrink-wrapped into error conditions\."  "cdce" } } */
-/* { dg-final { cleanup-tree-dump "cdce" } } */
+/* { dg-final { scan-tree-dump  "cdce1.c:16: note: function call is shrink-wrapped into error conditions\."  "cdce" } } */
 /* { dg-require-effective-target large_double } */
 
 #include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/cdce2.c b/gcc/testsuite/gcc.dg/cdce2.c
index a461ce7..55030f1 100644
--- a/gcc/testsuite/gcc.dg/cdce2.c
+++ b/gcc/testsuite/gcc.dg/cdce2.c
@@ -1,8 +1,7 @@
 /* { dg-do  run  } */
 /* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
-/* { dg-final { scan-tree-dump  "cdce2.c:16: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
-/* { dg-final { cleanup-tree-dump "cdce" } } */
+/* { dg-final { scan-tree-dump  "cdce2.c:15: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
  
 #include <stdlib.h>
 #include <math.h>
diff --git a/gcc/testsuite/gcc.dg/pch/save-temps-1.c b/gcc/testsuite/gcc.dg/pch/save-temps-1.c
index 9a5e722..345b4a6 100644
--- a/gcc/testsuite/gcc.dg/pch/save-temps-1.c
+++ b/gcc/testsuite/gcc.dg/pch/save-temps-1.c
@@ -5,5 +5,4 @@
 #endif
 #include <stddef.h>
 int x;
-
-/* { dg-final { cleanup-saved-temps ".s" } } */
+/* { dg-keep-saved-temps ".s" } */
diff --git a/gcc/testsuite/gcc.dg/strlenopt-22.c b/gcc/testsuite/gcc.dg/strlenopt-22.c
index d6fd4df..aa55f5e 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-22.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-22.c
@@ -36,5 +36,4 @@ main ()
 /* { dg-final { scan-tree-dump-times "strcpy \\(" 1 "strlen" } } */
 /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
 /* { dg-final { scan-tree-dump-times "strchr \\(" 1 "strlen" } } */
-/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } *
-/* { dg-final { cleanup-tree-dump "strlen" } } */
+/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */
diff --git a/gcc/testsuite/gcc.dg/strlenopt-24.c b/gcc/testsuite/gcc.dg/strlenopt-24.c
index 962e04f..639501a 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-24.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-24.c
@@ -13,5 +13,4 @@ main ()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } *
-/* { dg-final { cleanup-tree-dump "strlen" } } */
+/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp26.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp26.c
index 6215416..021d2de 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp26.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp26.c
@@ -9,8 +9,7 @@ foo(int a)
 }
 
 /* VRP should optimize this to a trivial "return 1".   */
-/* { dg-final { scan-tree-dump-times "return 1" 1 "vrp1" } } * /
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "return 1" 1 "vrp1" } } */
 
 
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp28.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp28.c
index 6b2a1fd..8c2a72b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp28.c
@@ -26,7 +26,6 @@ int f3 (unsigned char c)
     return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "if " 0 "vrp1" } } * /
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "if " 0 "vrp1" } } */
 
 
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 4fa433d..9e4ecce 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -105,6 +105,108 @@ if [check_effective_target_lto] {
     }
 }
 
+# Deduce generated files from tool flags, return finalcode string
+proc schedule-cleanups { opts } {
+    global additional_sources
+    set finalcode ""
+    set testcases {}
+    lappend testcases [lindex [testname-for-summary] 0]
+    verbose "Cleanup testcases: $testcases" 4
+    if { [info exists additional_sources] && $additional_sources != "" } {
+	lappend testcases $additional_sources
+	verbose "Cleanup testcases, additional: $additional_sources" 4
+    }
+    verbose "Cleanup all options: $opts" 4
+
+    # First some fixups to transform stuff to something manageable ..
+    # --dump= should translate to -d with joined operand.
+    if [regexp -- {(^|\s+)--dump=[^\s]+(\s+|$)} $opts] {
+	regsub -all -- {--dump=} $opts {-d} opts
+    }
+    # -da and -dx are treated as shorthand for -fdump-rtl-all here
+    if [regexp -- {(^|\s+)-d[ax](\s+|$)} $opts] {
+	verbose "Cleanup -d seen" 4
+	lappend opts "-fdump-rtl-all"
+    }
+    # .. and don't question why there is --dump=? and -d?
+
+    # Then handle options that generate non-dump files
+    # TODO
+    # -fprofile-generate -> cleanup-coverage-files()
+    # -fstack-usage -> cleanup-stack-usage()
+    if [regexp -- {(^|\s+)-fstack-usage(\s+|$)} $opts] {
+	verbose "Cleanup -fstack-usage seen" 4
+#	append finalcode "cleanup-stack-usage\n"
+    }
+    global keep_saved_temps_suffixes
+    if [info exists keep_saved_temps_suffixes ] {
+	verbose "dg-keep-saved-temps ${keep_saved_temps_suffixes}" 2
+    }
+    # -save-temps -> cleanup-saved-temps()
+    if [regexp -- {(^|\s+)-save-temps(\s+|$)} $opts] {
+	verbose "Cleanup -save-temps seen" 4
+	if [info exists keep_saved_temps_suffixes] {
+	    append finalcode "cleanup-saved-temps ${keep_saved_temps_suffixes}\n"
+	} else {
+	    append finalcode "cleanup-saved-temps\n"
+	}
+    } else {
+	if [info exists keep_saved_temps_suffixes ] {
+	    error "dg-keep-saved-temps specified but testcase does not -save-temps"
+	    return
+	}
+    }
+    # Finally see if there are any dumps in opts, otherwise we are done
+    if [regexp -- {(?=(?:^|[ \t]+)?)-fdump-[^ \t]+(?=(?:$|[ \t]+)?)} $opts] {
+        # Ipa, Rtl, Tree for simplicity
+        set ptn "{i,r,t}"
+    } else {
+        return $finalcode
+    }
+    # stem.ext.<passnum><fam>.<passname><pass-instances>
+    # (tree)passes can have multiple instances, thus optional trailing *
+    set ptn "\[0-9\]\[0-9\]\[0-9\]$ptn.*"
+    # Handle ltrans files around -flto
+    if [regexp -- {(^|\s+)-flto(\s+|$)} $opts] {
+	verbose "Cleanup -flto seen" 4
+	set ltrans "{ltrans\[0-9\]*.,}"
+    } else {
+	set ltrans ""
+    }
+    set ptn "$ltrans$ptn"
+    verbose "Cleanup final ptn: $ptn" 4
+    set tfiles {}
+    foreach src $testcases {
+	set basename [file tail $src]
+	if { $ltrans != "" } {
+	    # ??? should we use upvar 1 output_file instead of this (dup ?)
+	    set stem [file rootname $basename]
+	    set basename_ext [file extension $basename]
+	    if {$basename_ext != ""} {
+		regsub -- {^.*\.} $basename_ext {} basename_ext
+	    }
+	    lappend tfiles "$stem.{$basename_ext,exe}"
+	    unset basename_ext
+	} else {
+	    lappend tfiles $basename
+	}
+    }
+    if { [llength $tfiles] > 1 } {
+	set tfiles [join $tfiles ","]
+	set tfiles "{$tfiles}"
+    }
+    verbose "Cleanup final testcases: $tfiles" 4
+    # We have to quote the regex
+    regsub -all {([][$^?+*()|\\{}])} "$tfiles.$ptn" {\\\1} ptn
+    set final ""
+    append final {remove-build-file }
+    append final "\"$ptn\""
+    verbose "Cleanup final: $final" 4
+    append finalcode "$final\n"
+
+    return $finalcode
+}
+
 # Define gcc callbacks for dg.exp.
 
 proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
@@ -176,6 +278,7 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
 	}
     }
 
+    append finalcode [schedule-cleanups "$options $extra_tool_flags"]
     if { $extra_tool_flags != "" } {
 	lappend options "additional_flags=$extra_tool_flags"
     }
@@ -527,27 +630,6 @@ proc cleanup-repo-files { } {
     }
 }
 
-# Remove compiler-generated RTL dump files for the current test.
-#
-# SUFFIX is the filename suffix pattern.
-proc cleanup-rtl-dump { suffix } {
-  cleanup-dump "\[0-9\]\[0-9\]\[0-9\]r.$suffix"
-}
-
-# Remove a specific tree dump file for the current test.
-#
-# SUFFIX is the tree dump file suffix pattern.
-proc cleanup-tree-dump { suffix } {
-  cleanup-dump "\[0-9\]\[0-9\]\[0-9\]t.$suffix"
-}
-
-# Remove a specific ipa dump file for the current test.
-#
-# SUFFIX is the ipa dump file suffix pattern.
-proc cleanup-ipa-dump { suffix } {
-  cleanup-dump "\[0-9\]\[0-9\]\[0-9\]i.$suffix"
-}
-
 # Remove a final insns dump file for the current test.
 proc cleanup-final-insns-dump { } {
     set testcase [testname-for-summary]
@@ -592,30 +674,6 @@ proc cleanup-ada-spec { } {
     }
 }
 
-# Remove all dump files with the provided suffix.
-proc cleanup-dump { suffix } {
-    global additional_sources_used
-    set testcase [testname-for-summary]
-    # The name might include a list of options; extract the file name.
-    set src [file tail [lindex $testcase 0]]
-    remove-build-file "[file tail $src].$suffix"
-    remove-build-file "[file rootname [file tail $src]].exe.$suffix"
-    remove-build-file "[file rootname [file tail $src]].exe.ltrans\[0-9\]*.$suffix"
-    # -fcompare-debug dumps
-    remove-build-file "[file tail $src].gk.$suffix"
-
-    # Clean up dump files for additional source files.
-    if [info exists additional_sources_used] {
-	foreach srcfile $additional_sources_used {
-	    remove-build-file "[file tail $srcfile].$suffix"
-	    remove-build-file "[file rootname [file tail $srcfile]].exe.$suffix"
-	    remove-build-file "[file rootname [file tail $srcfile]].exe.ltrans\[0-9\]*.$suffix"
-	    # -fcompare-debug dumps
-	    remove-build-file "[file tail $srcfile].gk.$suffix"
-	}
-    }
-}
-
 # Remove files kept by --save-temps for the current test.
 #
 # Currently this is only .i, .ii, .s and .o files, but more can be added
@@ -658,6 +716,24 @@ proc cleanup-saved-temps { args } {
     }
 }
 
+
+# Files to be kept after cleanup of --save-temps for the current test.
+# ARGS is a list of suffixes to NOT delete.
+proc dg-keep-saved-temps { args } {
+    global keep_saved_temps_suffixes
+    set keep_saved_temps_suffixes {}
+
+    # add the to-be-kept suffixes
+    foreach suffix {".mii" ".ii" ".i" ".s" ".o" ".gkd" ".res" ".ltrans.out"} {
+	if {[lsearch $args $suffix] >= 0} {
+	    lappend keep_saved_temps_suffixes $suffix
+	}
+    }
+    if { [llength keep_saved_temps_suffixes] < 1 } {
+	error "dg-keep-saved-temps ${args} did not match any known suffix"
+    }
+}
+
 # Scan Fortran modules for a given regexp.
 #
 # Argument 0 is the module name
@@ -760,6 +836,7 @@ if { [info procs saved-dg-test] == [list] } {
 	global shouldfail
 	global testname_with_flags
 	global set_target_env_var
+	global keep_saved_temps_suffixes
 
 	if { [ catch { eval saved-dg-test $args } errmsg ] } {
 	    set saved_info $errorInfo
@@ -785,6 +862,9 @@ if { [info procs saved-dg-test] == [list] } {
 	if [info exists set_target_env_var] {
 	    unset set_target_env_var
 	}
+	if [info exists keep_saved_temps_suffixes] {
+	    unset keep_saved_temps_suffixes
+	}
 	unset_timeout_vars
 	if [info exists compiler_conditional_xfail_data] {
 	    unset compiler_conditional_xfail_data
diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 027ae9d..7d658b4 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -304,6 +304,9 @@ proc profopt-execute { src } {
 	    return
 	}
 
+	# schedule removal of dump files et al
+	# Do this before the call below destroys additional_sources..
+	append use_final_code [schedule-cleanups "$option $extra_flags"]
         set extra_options [dg-additional-files-options "" "$src"]
 
 	# Remove old profiling data files.  Make sure additional_sources_used is
diff --git a/gcc/testsuite/obj-c++.dg/encode-2.mm b/gcc/testsuite/obj-c++.dg/encode-2.mm
index 157bb52..77eb6ad 100644
--- a/gcc/testsuite/obj-c++.dg/encode-2.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-2.mm
@@ -24,5 +24,4 @@ const char *enc3 = @encode(anonymous);
 
 /* { dg-final { scan-assembler "{Vec<float>=ffi}" } }  */
 /* { dg-final { scan-assembler "{Vec<double>=ddi}" } }  */
-/* { dg-final { scan-file "encode-2.o" "{?={Vec<double>=ddi}{Vec<float>=ffi}fd{Vec<signed char>=cci}i}" } }
-/* { dg-final cleanup-saved-temps } */
+/* { dg-final { scan-file "encode-2.o" "{?={Vec<double>=ddi}{Vec<float>=ffi}fd{Vec<signed char>=cci}i}" } } */
-- 
1.7.10.4


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