From: Jose E. Marchesi Date: Sun, 30 Nov 2025 12:48:00 +0000 (+0100) Subject: fortran: testsuite: fix matching of language lists in diagnostics X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c85bf98ad29840d9829e1f5a2d9859a2fbad2037;p=thirdparty%2Fgcc.git fortran: testsuite: fix matching of language lists in diagnostics A few Fortran tests that pass both Fortran and C programs in the same compilation check for warnings like: { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } The problem is that the warning may actually indicate the option is valid for other languages other than Fortran. Like in: warning: command-line option ‘-fcheck=all’ is valid for Algol68/Fortran but not for C This patch modifies the regexps used in the tests in order to match the language list strings generated by opts-global.cc:write_langs. Tested in x86_64-linux-gnu with make check-gfortran. gcc/testsuite/ChangeLog PR fortran/122923 * gfortran.dg/ISO_Fortran_binding_17.f90: Recognize language list in warning regexp. * gfortran.dg/c-interop/allocate-errors.f90: Likewise. * gfortran.dg/c-interop/establish-errors.f90: Likewise. * gfortran.dg/c-interop/pr113338.f90: Likewise. * gfortran.dg/c-interop/section-errors.f90: Likewise. * gfortran.dg/c-interop/select-errors.f90: Likewise. * gfortran.dg/c-interop/setpointer-errors.f90: Likewise. --- diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 index c399e710ce9..43a011526ce 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-additional-sources ISO_Fortran_binding_17.c } ! { dg-options "-fcheck=all" } -! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-fcheck=all' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! PR fortran/92470 ! diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 index a58d05a3368..57bc709bc16 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-additional-sources "allocate-errors-c.c dump-descriptors.c" } ! { dg-additional-options "-Wno-error -fcheck=all" } -! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-fcheck=all' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! This program tests that the CFI_allocate and CFI_deallocate functions ! properly detect invalid arguments. All the interesting things happen diff --git a/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 index 307a2664b74..9dc88895bac 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 @@ -2,7 +2,7 @@ ! { dg-do run } ! { dg-additional-sources "establish-errors-c.c dump-descriptors.c" } ! { dg-additional-options "-Wno-error -fcheck=all" } -! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-fcheck=all' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! This program tests that the CFI_establish function properly detects ! invalid arguments. All the interesting things happen in the diff --git a/gcc/testsuite/gfortran.dg/c-interop/pr113338.f90 b/gcc/testsuite/gfortran.dg/c-interop/pr113338.f90 index a83c3ca93fa..6da3378bb93 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/pr113338.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/pr113338.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-additional-sources pr113338-c.c } ! { dg-additional-options "-Wno-error -O2 -std=f2018" } -! { dg-warning "command-line option '-std=f2018' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-std=f2018' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! PR fortran/113338 - F2018 extensions to interoperability of procedures diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 index 28328b799b3..bc52917a79f 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-additional-sources "section-errors-c.c dump-descriptors.c" } ! { dg-additional-options "-Wno-error -fcheck=all" } -! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-fcheck=all' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! This program tests that the CFI_section function properly detects ! invalid arguments. All the interesting things happen in the diff --git a/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 index b719c9e6867..584a302fc34 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-additional-sources "select-errors-c.c dump-descriptors.c" } ! { dg-additional-options "-Wno-error -fcheck=all" } -! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-fcheck=all' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! This program tests that the CFI_select_part function properly detects ! invalid arguments. All the interesting things happen in the diff --git a/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 index 84a01ce16b1..15ea7baffaa 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 @@ -2,7 +2,7 @@ ! { dg-do run } ! { dg-additional-sources "setpointer-errors-c.c dump-descriptors.c" } ! { dg-additional-options "-Wno-error -fcheck=all" } -! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } +! { dg-warning "command-line option '-fcheck=all' is valid for (\[a-zA-Z0-9]+/)*Fortran(/\[a-zA-Z0-9]+)* but not for C" "" { target *-*-* } 0 } ! ! This program tests that the CFI_setpointer function properly detects ! invalid arguments. All the interesting things happen in the