[02/12] OpenMP/C: Change repetitive allocator clause diagnostic wording

Message ID 20260505151030.1749548-3-waffl3x@baylibre.com
State New
Headers
Series OpenMP/C++: 'allocate' directive |

Commit Message

Waffl3x May 5, 2026, 3:01 p.m. UTC
  This is specifically for an allocator clause in an allocate directive.

The old text, 'allocator' clause allocator expression, does not flow very
well. This patch removes the redundant second allocator from the diagnostic.
This case reads poorly because the two words are the same, but there are
other diagnostics that use the same pattern that we could consider changing
as well. For example, 'allocate' clause allocator expression, despite being
two different words still feels rather redundant.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_allocate): Change diagnostic.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/allocate-5.c: Match new diagnostic.

Signed-off-by: Waffl3x <waffl3x@baylibre.com>
---
 gcc/c/c-parser.cc                            | 2 +-
 gcc/testsuite/c-c++-common/gomp/allocate-5.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 0b8b2387109..c7b04fb5cf9 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -23488,7 +23488,7 @@  c_parser_omp_allocate (c_parser *parser)
 		 != get_identifier ("omp_allocator_handle_t"))
 	    {
 	      error_at (expr_loc,
-			"%<allocator%> clause allocator expression has type "
+			"%<allocator%> clause expression has type "
 			"%qT rather than %<omp_allocator_handle_t%>",
 			TREE_TYPE (allocator));
 	      allocator = NULL_TREE;
diff --git a/gcc/testsuite/c-c++-common/gomp/allocate-5.c b/gcc/testsuite/c-c++-common/gomp/allocate-5.c
index 2ca4786264f..09c8e4342f0 100644
--- a/gcc/testsuite/c-c++-common/gomp/allocate-5.c
+++ b/gcc/testsuite/c-c++-common/gomp/allocate-5.c
@@ -40,7 +40,7 @@  bar ()
 #pragma omp allocate(a) foo(my_allocator) /* { dg-error "expected 'allocator'" } */
   /* { dg-error "expected end of line before '\\(' token" "" { target *-*-* } .-1 } */
   /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-2 } */
-#pragma omp allocate(a2) allocator(b)  /* { dg-error "'allocator' clause allocator expression has type 'int' rather than 'omp_allocator_handle_t'" "todo: cp/semantics.c" { xfail c++ } } */
+#pragma omp allocate(a2) allocator(b)  /* { dg-error "'allocator' clause expression has type 'int' rather than 'omp_allocator_handle_t'" "todo: cp/semantics.c" { xfail c++ } } */
   /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-1 } */
 }