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] gcc-dg.exp: support more than one digit in relative line number notation


In r240391 Jakub added relative line number notation (.+4 or .-1 etc)
for DejaGnu messages.

This patch tweaks the regex to allow relative line numbers containing
more than one digit (I ran into this with a test for a diagnostic
that issues multiple notes, for which I wanted to verify the
diagnostic_show_locus output, hence I had offsets > 9).

Successfully regression-tested (and bootstrapped) on x86_64-pc-linux-gnu;
adds 2 PASS results to gcc.sum.

OK for trunk?

gcc/testsuite/ChangeLog:
	* gcc.dg/dg-test-1.c: Add tests of relative line specifications
	with more than one digit.
	* lib/gcc-dg.exp (process-message): Support more than one digit
	in relative line specifications.
---
 gcc/testsuite/gcc.dg/dg-test-1.c | 24 ++++++++++++++++++++++++
 gcc/testsuite/lib/gcc-dg.exp     |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/dg-test-1.c b/gcc/testsuite/gcc.dg/dg-test-1.c
index ad67b24..c67f93b 100644
--- a/gcc/testsuite/gcc.dg/dg-test-1.c
+++ b/gcc/testsuite/gcc.dg/dg-test-1.c
@@ -16,3 +16,27 @@ void				/* { dg-warning "unused parameter 'f'" "warn2" { target *-*-* } .+1 } */
 bar (int e, int f, int g, int h)/* { dg-warning "unused parameter 'g'" "warn3" { target *-*-* } . } */
 {				/* { dg-warning "unused parameter 'h'" "warn4" { target *-*-* } .-1 } */
 }
+
+
+/* Ensure that relative line numbers with more than one digit are supported.  */
+/* { dg-warning "unused parameter 'i'" "warn5" { target *-*-* } .+10 } */
+
+
+
+
+
+
+
+
+void
+baz (int i, int j)
+{
+}
+
+
+
+
+
+
+
+/* { dg-warning "unused parameter 'j'" "warn6" { target *-*-* } .-10 } */
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 6217272..a12357d 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -988,7 +988,7 @@ proc process-message { msgproc msgprefix dgargs } {
 
     # Handle relative line specification, .+1 or .-1 etc.
     if { [llength $dgargs] == 5
-	 && [regsub "^\.\[+-\](\[0-9\])$" [lindex $dgargs 4] "\\1" num] } {
+	 && [regsub "^\.\[+-\](\[0-9\]+)$" [lindex $dgargs 4] "\\1" num] } {
 	set num [expr [lindex $dgargs 0] [string index [lindex $dgargs 4] 1] $num]
 	set dgargs [lreplace $dgargs 4 4 $num]
     }
-- 
1.8.5.3


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