commit a899401404186843f38462c8fc9de733f19ce864
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue May 30 12:49:09 2023 +0200

    OpenMP: Improve C/C++ parsing error message [PR109999]
    
    Replace
      error: expected '#pragma omp' clause before ...
    by the the more readable/clearer
      error: expected an OpenMP clause before ...
    
    (And likewise for '#pragma acc' and OpenACC.)
    
            PR c/109999
    
    gcc/c/ChangeLog:
    
            * c-parser.cc (c_parser_oacc_all_clauses,
            c_parser_omp_all_clauses): Improve error wording.
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_oacc_all_clauses,
            cp_parser_omp_all_clauses): Improve error wording.
    
    gcc/testsuite/ChangeLog:
    
            * c-c++-common/goacc/asyncwait-1.c: Update dg-error.
            * c-c++-common/goacc/clauses-fail.c: Likewise.
            * c-c++-common/goacc/data-2.c: Likewise.
            * c-c++-common/gomp/declare-target-2.c: Likewise.
            * c-c++-common/gomp/directive-1.c: Likewise.
            * g++.dg/goacc/data-1.C: Likewise.
---
 gcc/c/c-parser.cc                                  | 4 ++--
 gcc/cp/parser.cc                                   | 4 ++--
 gcc/testsuite/c-c++-common/goacc/asyncwait-1.c     | 4 ++--
 gcc/testsuite/c-c++-common/goacc/clauses-fail.c    | 8 ++++----
 gcc/testsuite/c-c++-common/goacc/data-2.c          | 2 +-
 gcc/testsuite/c-c++-common/gomp/declare-target-2.c | 4 ++--
 gcc/testsuite/c-c++-common/gomp/directive-1.c      | 2 +-
 gcc/testsuite/g++.dg/goacc/data-1.C                | 4 ++--
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 0ec75348091..5baa501dbee 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -17692,7 +17692,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
 						c_name, clauses);
 	  break;
 	default:
-	  c_parser_error (parser, "expected %<#pragma acc%> clause");
+	  c_parser_error (parser, "expected an OpenACC clause");
 	  goto saw_error;
 	}
 
@@ -18050,7 +18050,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
 	  c_name = "enter";
 	  break;
 	default:
-	  c_parser_error (parser, "expected %<#pragma omp%> clause");
+	  c_parser_error (parser, "expected an OpenMP clause");
 	  goto saw_error;
 	}
 
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 5feed77c7ac..1c9aa671851 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -41087,7 +41087,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
 						 c_name, clauses);
 	  break;
 	default:
-	  cp_parser_error (parser, "expected %<#pragma acc%> clause");
+	  cp_parser_error (parser, "expected an OpenACC clause");
 	  goto saw_error;
 	}
 
@@ -41489,7 +41489,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
 	  c_name = "enter";
 	  break;
 	default:
-	  cp_parser_error (parser, "expected %<#pragma omp%> clause");
+	  cp_parser_error (parser, "expected an OpenMP clause");
 	  goto saw_error;
 	}
 
diff --git a/gcc/testsuite/c-c++-common/goacc/asyncwait-1.c b/gcc/testsuite/c-c++-common/goacc/asyncwait-1.c
index 1857d65a0b2..3f0b1451cf6 100644
--- a/gcc/testsuite/c-c++-common/goacc/asyncwait-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/asyncwait-1.c
@@ -185,9 +185,9 @@ f (int N, float *a, float *b)
 
 #pragma acc wait (1.0) /* { dg-error "expression must be integral" } */
 
-#pragma acc wait 1 /* { dg-error "expected '#pragma acc' clause before numeric constant" } */
+#pragma acc wait 1 /* { dg-error "expected an OpenACC clause before numeric constant" } */
 
-#pragma acc wait N /* { dg-error "expected '#pragma acc' clause before 'N'" } */
+#pragma acc wait N /* { dg-error "expected an OpenACC clause before 'N'" } */
 
 #pragma acc wait async (1 2) /* { dg-error "expected '\\)' before numeric constant" } */
 
diff --git a/gcc/testsuite/c-c++-common/goacc/clauses-fail.c b/gcc/testsuite/c-c++-common/goacc/clauses-fail.c
index 853d010d038..41d7e6bd194 100644
--- a/gcc/testsuite/c-c++-common/goacc/clauses-fail.c
+++ b/gcc/testsuite/c-c++-common/goacc/clauses-fail.c
@@ -5,17 +5,17 @@ f (void)
 {
   int i;
 
-#pragma acc parallel one /* { dg-error "expected '#pragma acc' clause before 'one'" } */
+#pragma acc parallel one /* { dg-error "expected an OpenACC clause before 'one'" } */
   ;
 
-#pragma acc kernels eins /* { dg-error "expected '#pragma acc' clause before 'eins'" } */
+#pragma acc kernels eins /* { dg-error "expected an OpenACC clause before 'eins'" } */
   ;
 
-#pragma acc data two /* { dg-error "expected '#pragma acc' clause before 'two'" } */
+#pragma acc data two /* { dg-error "expected an OpenACC clause before 'two'" } */
   ;
 
 #pragma acc parallel
-#pragma acc loop deux /* { dg-error "expected '#pragma acc' clause before 'deux'" } */
+#pragma acc loop deux /* { dg-error "expected an OpenACC clause before 'deux'" } */
   for (i = 0; i < 2; ++i)
     ;
 }
diff --git a/gcc/testsuite/c-c++-common/goacc/data-2.c b/gcc/testsuite/c-c++-common/goacc/data-2.c
index a8723b04c8f..eafe1454336 100644
--- a/gcc/testsuite/c-c++-common/goacc/data-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/data-2.c
@@ -5,7 +5,7 @@ foo (void)
   int n;
 #pragma acc enter data copyin (a, b) async wait
 #pragma acc enter data create (b[20:30]) async wait
-#pragma acc enter data (a) /* { dg-error "expected '#pragma acc' clause before '\\\(' token" } */
+#pragma acc enter data (a) /* { dg-error "expected an OpenACC clause before '\\\(' token" } */
 /* { dg-error "has no data movement clause" "" { target *-*-* } .-1 } */
 #pragma acc enter data create (b(1:10)) /* { dg-error "expected '\\\)' before '\\\(' token" } */
 #pragma acc exit data delete (a) if (0)
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-target-2.c b/gcc/testsuite/c-c++-common/gomp/declare-target-2.c
index 97602dc7992..7b47e2b4182 100644
--- a/gcc/testsuite/c-c++-common/gomp/declare-target-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/declare-target-2.c
@@ -59,7 +59,7 @@ int n, o, s, t;
 #pragma omp declare target (s, t, s)		/* { dg-error "appears more than once on the same .declare target. directive" } */
 int p, q, r;
 #pragma omp declare target (p) to (q)		/* { dg-error "expected end of line before .to." } */
-#pragma omp declare target to (p) (q) link (r)	/* { dg-error "expected .#pragma omp. clause before" } */
-#pragma omp declare target link (r) (p)		/* { dg-error "expected .#pragma omp. clause before" } */
+#pragma omp declare target to (p) (q) link (r)	/* { dg-error "expected an OpenMP clause before" } */
+#pragma omp declare target link (r) (p)		/* { dg-error "expected an OpenMP clause before" } */
 #pragma omp declare target
 #pragma omp end declare target to (p)		/* { dg-error "expected end of line before .to." } */
diff --git a/gcc/testsuite/c-c++-common/gomp/directive-1.c b/gcc/testsuite/c-c++-common/gomp/directive-1.c
index e1218bd6869..fc441538778 100644
--- a/gcc/testsuite/c-c++-common/gomp/directive-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/directive-1.c
@@ -20,7 +20,7 @@ foo (void)
   #pragma omp allocate, (i)			/* { dg-error "expected '\\\(' before ',' token" } */
 						/* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
 						/* { dg-message "not yet supported" "" { target *-*-* } .-2 } */
-  #pragma omp critical, (bar)			/* { dg-error "expected '#pragma omp' clause before '\\\(' token" } */
+  #pragma omp critical, (bar)			/* { dg-error "expected an OpenMP clause before '\\\(' token" } */
   ;
   #pragma omp flush, (k, l)			/* { dg-error "expected '\\\(' or end of line before ',' token" "" { target c } } */
 						/* { dg-error "expected end of line before ',' token" "" { target c++ } .-1 } */
diff --git a/gcc/testsuite/g++.dg/goacc/data-1.C b/gcc/testsuite/g++.dg/goacc/data-1.C
index 73de964a518..58f333652cd 100644
--- a/gcc/testsuite/g++.dg/goacc/data-1.C
+++ b/gcc/testsuite/g++.dg/goacc/data-1.C
@@ -5,7 +5,7 @@ foo (int &a, int (&b)[100], int &n)
 #pragma acc enter data create (b[20:30]) async wait
 
 #pragma acc enter data (a)
-  /* { dg-error "expected '#pragma acc' clause before '\\\(' token" "" { target *-*-* } .-1 } */
+  /* { dg-error "expected an OpenACC clause before '\\\(' token" "" { target *-*-* } .-1 } */
   /* { dg-error "has no data movement clause" "" { target *-*-* } .-2 } */
 
 #pragma acc enter data create (b(1:10)) /* { dg-error "expected '\\\)' before '\\\(' token" } */
@@ -28,7 +28,7 @@ foo (T &a, T (&b)[100], T &n)
 #pragma acc enter data create (b[20:30]) async wait
 
 #pragma acc enter data (a)
-  /* { dg-error "expected '#pragma acc' clause before '\\\(' token" "" { target *-*-* } .-1 } */
+  /* { dg-error "expected an OpenACC clause before '\\\(' token" "" { target *-*-* } .-1 } */
   /* { dg-error "has no data movement clause" "" { target *-*-* } .-2 } */
 
 #pragma acc enter data create (b(1:10)) /* { dg-error "expected '\\\)' before '\\\(' token" } */
