public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix finish_omp_clauses diagnostics (PR c++/35337)
@ 2008-03-10 20:24 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2008-03-10 20:24 UTC (permalink / raw)
  To: gcc-patches

Hi!

When fixing PR31748 I've missed that similar errors are handled separately
for firstprivate and lastprivate (as firstprivate+lastprivate for the same
var is allowed).  This patch fixes that, bootstrapped/regtested on
x86_64-linux, committed to trunk.  Will commit to 4.3 branch soon.

2008-03-10  Jakub Jelinek  <jakub@redhat.com>

	PR c++/35337
	* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
	DECL_P in not a variable and appears more than once error messages.

--- gcc/cp/semantics.c.jj	2008-02-19 11:15:06.000000000 +0100
+++ gcc/cp/semantics.c	2008-03-10 17:03:00.000000000 +0100
@@ -3400,13 +3400,16 @@ finish_omp_clauses (tree clauses)
 	    {
 	      if (processing_template_decl)
 		break;
-	      error ("%qE is not a variable in clause %<firstprivate%>", t);
+	      if (DECL_P (t))
+		error ("%qD is not a variable in clause %<firstprivate%>", t);
+	      else
+		error ("%qE is not a variable in clause %<firstprivate%>", t);
 	      remove = true;
 	    }
 	  else if (bitmap_bit_p (&generic_head, DECL_UID (t))
 		   || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
 	    {
-	      error ("%qE appears more than once in data clauses", t);
+	      error ("%qD appears more than once in data clauses", t);
 	      remove = true;
 	    }
 	  else
@@ -3419,13 +3422,16 @@ finish_omp_clauses (tree clauses)
 	    {
 	      if (processing_template_decl)
 		break;
-	      error ("%qE is not a variable in clause %<lastprivate%>", t);
+	      if (DECL_P (t))
+		error ("%qD is not a variable in clause %<lastprivate%>", t);
+	      else
+		error ("%qE is not a variable in clause %<lastprivate%>", t);
 	      remove = true;
 	    }
 	  else if (bitmap_bit_p (&generic_head, DECL_UID (t))
 		   || bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
 	    {
-	      error ("%qE appears more than once in data clauses", t);
+	      error ("%qD appears more than once in data clauses", t);
 	      remove = true;
 	    }
 	  else
--- gcc/testsuite/g++.dg/gomp/pr35337.C.jj	2008-03-10 16:56:54.000000000 +0100
+++ gcc/testsuite/g++.dg/gomp/pr35337.C	2008-03-10 17:00:15.000000000 +0100
@@ -0,0 +1,20 @@
+// PR c++/35337
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A { };
+
+void
+foo ()
+{
+#pragma omp parallel firstprivate(A)	// { dg-error "struct A\[^\n\]*is not a variable" }
+  ;
+}
+
+void
+bar ()
+{
+#pragma omp for lastprivate(A)		// { dg-error "struct A\[^\n\]*is not a variable" }
+  for (int i = 0; i < 10; i++)
+    ;
+}

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-10 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-10 20:24 [PATCH] Fix finish_omp_clauses diagnostics (PR c++/35337) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).