aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib/gfortran-dg.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/lib/gfortran-dg.exp')
-rw-r--r--gcc/testsuite/lib/gfortran-dg.exp48
1 files changed, 42 insertions, 6 deletions
diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 2387403030b..247df02bd0c 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,11 +25,47 @@ proc gfortran-dg-test { prog do_what extra_tool_flags } {
set comp_output [lindex $result 0]
set output_file [lindex $result 1]
- # Put the error message on the same line as the line number
- # FIXME: Add a colon after line number
- # Remove the line of source code with the error and
- # the number pointing to error
- regsub -all "\n\n\[^\n\]*\n *\[0-9\]*\n" $comp_output ": " comp_output
+ # gfortran error messages look like this:
+ # In file [name]:[line]
+ #
+ # some code
+ # 1
+ # Error: Some error at (1) and (2)
+ # or
+ # In file [name]:[line]
+ #
+ # some code
+ # 1
+ # In file [name]:[line2]
+ #
+ # some other code
+ # 2
+ # Error: Some error at (1) and (2)
+ # or
+ # In file [name]:[line]
+ #
+ # some code and some more code
+ # 1 2
+ # Error: Some error at (1) and (2)
+ #
+ # We collapse these to look like:
+ # [name]:[line]: Error: Some error at (1) and (2)
+ # or
+ # [name]:[line]: Error: Some error at (1) and (2)
+ # [name]:[line2]: Error: Some error at (1) and (2)
+ # We proceed in two steps: first we deal with the form with two
+ # different locus lines, then with the form with only one locus line.
+ #
+ # Note that these regexps only make sense in the combinations used below.
+ # Note also that is imperative that we first deal with the form with
+ # two loci.
+ set locus_regexp " In file (\[^\n\]*)\n\n\[^\n\]*\n\[^\n\]*\n"
+ set diag_regexp "(\[^\n\]*)\n"
+
+ set two_loci "$locus_regexp$locus_regexp$diag_regexp"
+ set single_locus "$locus_regexp$diag_regexp"
+ regsub -all $two_loci $comp_output "\\1: \\3\n\\2: \\3\n" comp_output
+ regsub -all $single_locus $comp_output "\\1: \\2\n" comp_output
return [list $comp_output $output_file]
}