https://gcc.gnu.org/g:c85bf98ad29840d9829e1f5a2d9859a2fbad2037
commit r16-5782-gc85bf98ad29840d9829e1f5a2d9859a2fbad2037 Author: Jose E. Marchesi <[email protected]> Date: Sun Nov 30 13:48:00 2025 +0100 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: --- gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 | 2 +- gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 | 2 +- gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 | 2 +- gcc/testsuite/gfortran.dg/c-interop/pr113338.f90 | 2 +- gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 | 2 +- gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 | 2 +- gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 index c399e710ce97..43a011526ce3 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 a58d05a33681..57bc709bc160 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 307a2664b743..9dc88895bac9 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 a83c3ca93faa..6da3378bb93c 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 28328b799b30..bc52917a79fa 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 b719c9e68679..584a302fc34a 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 84a01ce16b12..15ea7baffaaa 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
