[COMMITTED] testsuite: Fix dg-do-if
Checks
Commit Message
Tests that use dg-do-if ERROR when the target selector matches, e.g.
ERROR: gcc.dg/vect/vect-simd-clone-16f.c -flto -ffat-lto-objects: compile: syntax error for " dg-do-if 1 compile { target { sse2_runtime && { ! sse4_runtime } } } "
While the error message isn't particularly helpful, it's from dg.exp
(dg-do): like the other dg-* procs it expects the line number to be the
first argument. However, dg-do-if strips that, so dg-do gets the target
selector instead of the expected action keyword.
Fixed by no longer stripping the line number.
Tested on amd64-pc-freebsd15.0 (sse2_runtime && !sse4_runtime),
i386-pc-solaris2.11 and x86_64-pc-linux-gnu (sse2_runtime &&
sse4_runtime).
Committed to trunk.
I cannot help thinking that dg-do-if is overkill: it's only used in 4
test cases and never actually worked.
Rainer
# HG changeset patch
# Parent eda78d3442ceaf2f46fa3d600b731501478cb561
testsuite: Fix dg-do-if
@@ -422,9 +422,8 @@ proc check-flags { args } {
# (possibly the default) prevails.
proc dg-do-if { args } {
- set args [lreplace $args 0 0]
# Verify the number of arguments.
- if { [llength $args] != 2 } {
+ if { [llength $args] != 3 } {
error "syntax error, need a single action and target selector"
}
@@ -435,7 +434,7 @@ proc dg-do-if { args } {
}
# Evaluate selector, return if it does not match.
- switch [dg-process-target-1 [lindex $args 1]] {
+ switch [dg-process-target-1 [lindex $args 2]] {
"N" { return }
"P" { return }
}