]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fortran: testsuite: fix matching of language lists in diagnostics
authorJose E. Marchesi <jose.marchesi@oracle.com>
Sun, 30 Nov 2025 12:48:00 +0000 (13:48 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Sun, 30 Nov 2025 19:15:45 +0000 (20:15 +0100)
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.

gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90
gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90
gcc/testsuite/gfortran.dg/c-interop/pr113338.f90
gcc/testsuite/gfortran.dg/c-interop/section-errors.f90
gcc/testsuite/gfortran.dg/c-interop/select-errors.f90
gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90

index c399e710ce9751d97061f180df440a1ebfe991ca..43a011526ce36014320c011793d2c48850466d24 100644 (file)
@@ -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
 !
index a58d05a336816e6d5df3208de643a8670eb61982..57bc709bc16008c30c4718bba59f4d2f6d744df9 100644 (file)
@@ -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
index 307a2664b74344496befc3ab0e8c362c9dce8c1e..9dc88895bac9f290e0ee72eb77dfbaa87c7c3bb6 100644 (file)
@@ -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 
index a83c3ca93faa801e015f6ddad2dc1a9dacf63726..6da3378bb93cd33f3753ee229ec0ea07b4d82eb2 100644 (file)
@@ -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
 
index 28328b799b309e1bf33d0b3ef1619e3be26a9d4d..bc52917a79fa5d5f8b4c04402cad208e37815cce 100644 (file)
@@ -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 
index b719c9e68679a0ea7f006161fef444455c9d4e32..584a302fc34a8d9b75bd9cfc69c354826f443f06 100644 (file)
@@ -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 
index 84a01ce16b120d0547f731adc1224b1a416a7377..15ea7baffaaa42dcde834cee7fe576fa173bfbee 100644 (file)
@@ -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