Following what is done on the C/C++ side, which uses fixit hints,
also Fortran deserves a hint how to write the 5.2 syntax.

Thus, the deprecation warning now states how to do the conversion.

Committed as r16-6073-gd02eebea7ea937

Tobias
commit d02eebea7ea937026c4de4453b3753088da38dd8
Author: Tobias Burnus <[email protected]>
Date:   Fri Dec 12 22:44:15 2025 +0100

    OpenMP/Fortran: uses_allocators - suggest 5.2 format in the warning
    
    Actually mention how the new 5.2+ syntax looks like when outputting
    the deprecation warning for 'uses_allocators'.
    
    gcc/fortran/ChangeLog:
    
            * openmp.cc (gfc_match_omp_clause_uses_allocators): Mention
            new syntax in deprecation warning.
    
    libgomp/ChangeLog:
    
            * testsuite/libgomp.fortran/dep-uses-allocators.f90: Update
            dg-warning.
---
 gcc/fortran/openmp.cc                                     | 4 +++-
 libgomp/testsuite/libgomp.fortran/dep-uses-allocators.f90 | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 68533a77882..af89c87b0ab 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -1864,7 +1864,9 @@ gfc_match_omp_clause_uses_allocators (gfc_omp_clauses *c)
 			 "The specification of arguments to "
 			 "%<uses_allocators%> at %L where each item is of "
 			 "the form %<allocator(traits)%> is deprecated since "
-			 "OpenMP 5.2", &p->where);
+			 "OpenMP 5.2; instead use %<uses_allocators(traits(%s"
+			 "): %s)%>", &p->where, p->u2.traits_sym->name,
+			 p->sym->name);
 	}
       else if (gfc_peek_ascii_char () == '(')
 	{
diff --git a/libgomp/testsuite/libgomp.fortran/dep-uses-allocators.f90 b/libgomp/testsuite/libgomp.fortran/dep-uses-allocators.f90
index c48bca2ffa9..6194dad2cfc 100644
--- a/libgomp/testsuite/libgomp.fortran/dep-uses-allocators.f90
+++ b/libgomp/testsuite/libgomp.fortran/dep-uses-allocators.f90
@@ -1,5 +1,5 @@
 ! { dg-do compile }
-! { dg-warning "The specification of arguments to 'uses_allocators' at \\(1\\) where each item is of the form 'allocator\\(traits\\)' is deprecated since OpenMP 5.2 \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 11 }
+! { dg-warning "The specification of arguments to 'uses_allocators' at \\(1\\) where each item is of the form 'allocator\\(traits\\)' is deprecated since OpenMP 5.2; instead use 'uses_allocators(traits(trait): a1)' \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 11 }
 
 program test
   use omp_lib

Reply via email to