The wrappers for dg-warning and dg-error that handle relative line
numbers with process-message are only activated if the global
variables gcc_warning_prefix and gcc_error_prefix, respectively, are
defined.

gnat.exp didn't set these variables, so we couldn't use relative line
numbers.

Set them to empty strings, for minimal disruption.

Regstrapped on x86_64-linux-gnu.  IIUC Marc also tried it with a WIP
gnat.dg testcase that relied on this feature, that wasn't working
before.  Ok?


for  gcc/testsuite/ChangeLog

        * lib/gnat.exp (gnat_init): Set gcc_warning_prefix and
        gcc_error_prefix.
---
 gcc/testsuite/lib/gnat.exp |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/testsuite/lib/gnat.exp b/gcc/testsuite/lib/gnat.exp
index d4d27a8cb41cf..e30cf8e652927 100644
--- a/gcc/testsuite/lib/gnat.exp
+++ b/gcc/testsuite/lib/gnat.exp
@@ -88,6 +88,8 @@ proc gnat_init { args } {
     global GNAT_UNDER_TEST
     global TOOL_EXECUTABLE
     global gnat_target_current
+    global gcc_warning_prefix
+    global gcc_error_prefix
 
     set gnat_target_current ""
 
@@ -104,6 +106,11 @@ proc gnat_init { args } {
     if ![info exists tmpdir] then {
        set tmpdir /tmp
     }
+
+    # Setting these variables enables the use of relative line numbers
+    # in dg-error and dg-warning wrappers in gcc-dg.exp.
+    set gcc_warning_prefix ""
+    set gcc_error_prefix ""
 }
 
 proc gnat_target_compile { source dest type options } {


-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to