From c2e755187e40754b4e90b5791a62826633e31f05 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sun, 1 Jul 2018 15:54:38 +0000 Subject: [PATCH] [testsuite/guality] Use relative line numbers in vla-1.c 2018-07-01 Tom de Vries * lib/gcc-dg.exp (get-absolute-line): Handle '.'. * gcc.dg/guality/vla-1.c: Use relative line numbers. From-SVN: r262286 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/guality/vla-1.c | 8 ++++---- gcc/testsuite/lib/gcc-dg.exp | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2939c6fe31..d24b0b4e430 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-07-01 Tom de Vries + + * lib/gcc-dg.exp (get-absolute-line): Handle '.'. + * gcc.dg/guality/vla-1.c: Use relative line numbers. + 2018-07-01 Tom de Vries * gcc.dg-selftests/dg-final.exp (verify_call_1): Factor out of ... diff --git a/gcc/testsuite/gcc.dg/guality/vla-1.c b/gcc/testsuite/gcc.dg/guality/vla-1.c index 651465428ac..264b9f3f92b 100644 --- a/gcc/testsuite/gcc.dg/guality/vla-1.c +++ b/gcc/testsuite/gcc.dg/guality/vla-1.c @@ -13,15 +13,15 @@ int __attribute__((noinline)) f1 (int i) { char a[i + 1]; - a[0] = 5; /* { dg-final { gdb-test 17 "i" "5" } } */ - return a[0]; /* { dg-final { gdb-test 17 "sizeof (a)" "6" } } */ + a[0] = 5; /* { dg-final { gdb-test .+1 "i" "5" } } */ + return a[0]; /* { dg-final { gdb-test . "sizeof (a)" "6" } } */ } int __attribute__((noinline)) f2 (int i) { - short a[i * 2 + 7]; /* { dg-final { gdb-test 24 "i" "5" } } */ - bar (a); /* { dg-final { gdb-test 24 "sizeof (a)" "17 * sizeof (short)" } } */ + short a[i * 2 + 7]; /* { dg-final { gdb-test .+1 "i" "5" } } */ + bar (a); /* { dg-final { gdb-test . "sizeof (a)" "17 * sizeof (short)" } } */ return a[i + 4]; } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 4f1796348c3..9e0b3f4ef95 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1066,6 +1066,10 @@ proc dg-line { linenr varname } { # Argument 1 is the relative line number or line number variable reference # proc get-absolute-line { useline line } { + if { "$line" == "." } { + return $useline + } + if { [regsub "^\.\[+-\](\[0-9\]+)$" $line "\\1" num] && $useline != "" } { # Handle relative line specification, .+1 or .-1 etc. set num [expr $useline [string index $line 1] $num] -- 2.30.2