diff mbox

[gomp4.1] Support C++ "this" in OpenMP directives

Message ID 20150715152714.GZ1788@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek July 15, 2015, 3:27 p.m. UTC
On Wed, Jul 15, 2015 at 03:47:54PM +0300, Ilya Verbin wrote:
> On Thu, Jul 09, 2015 at 10:50:14 +0200, Jakub Jelinek wrote:
> > 	* parser.c (cp_parser_omp_var_list_no_open): Parse this.
> > 	* cp-tree.h (finish_omp_declare_simd_methods): New prototype.
> > 	* semantics.c (handle_omp_array_sections_1): Disallow this based
> > 	array sections for OpenMP.
> > 	(finish_omp_declare_simd_methods): New function.
> > 	(finish_omp_clauses): Don't attempt to adjust linear step of
> > 	this if it points to TYPE_BEING_DEFINED.  Disallow this in
> > 	all clauses expecting variable lists, except for declare simd
> > 	linear/uniform/aligned clauses.
> > 	(finish_struct_1): Call finish_omp_declare_simd_methods.
> > 
> > 	* g++.dg/vect/simd-clone-2.cc: New test.
> > 	* g++.dg/vect/simd-clone-2.h: New file.
> > 	* g++.dg/vect/simd-clone-3.cc: New test.
> > 	* g++.dg/vect/simd-clone-4.cc: New test.
> > 	* g++.dg/vect/simd-clone-4.h: New file.
> > 	* g++.dg/vect/simd-clone-5.cc: New test.
> > 	* g++.dg/gomp/this-1.C: New test.
> > 	* g++.dg/gomp/this-2.C: New test.
> 
> One more warning:
> 
> gcc/cp/parser.c: In function ‘tree_node* cp_parser_omp_var_list_no_open(cp_parser*, omp_clause_code, tree, bool*)’:
> gcc/cp/parser.c:27931:26: error: ‘name’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>           token->location);
>                           ^
> cc1plus: all warnings being treated as errors
> make[4]: *** [cp/parser.o] Error 1

Thanks, here is a fix:

2015-07-15  Jakub Jelinek  <jakub@redhat.com>

	* parser.c (cp_parser_omp_var_list_no_open): Don't process
	RID_THIS for kind == 0.  Don't call cp_parser_name_lookup_error
	if finish_this_expr returned error_mark_node.



	Jakub
diff mbox

Patch

--- gcc/parser.c	(revision 225817)
+++ gcc/parser.c	(working copy)
@@ -27910,7 +27910,9 @@  cp_parser_omp_var_list_no_open (cp_parse
       tree name, decl;
 
       token = cp_lexer_peek_token (parser->lexer);
-      if (current_class_ptr && cp_parser_is_keyword (token, RID_THIS))
+      if (kind != 0
+	  && current_class_ptr
+	  && cp_parser_is_keyword (token, RID_THIS))
 	{
 	  decl = finish_this_expr ();
 	  if (TREE_CODE (decl) == NON_LVALUE_EXPR
@@ -27929,10 +27931,12 @@  cp_parser_omp_var_list_no_open (cp_parse
 	    goto skip_comma;
 
 	  decl = cp_parser_lookup_name_simple (parser, name, token->location);
+	  if (decl == error_mark_node)
+	    cp_parser_name_lookup_error (parser, name, decl, NLE_NULL,
+					 token->location);
 	}
       if (decl == error_mark_node)
-	cp_parser_name_lookup_error (parser, name, decl, NLE_NULL,
-				     token->location);
+	;
       else if (kind != 0)
 	{
 	  switch (kind)