[1/5] gomp-3_0-branch merge to trunk - generic C++ FE changes

Jakub Jelinek jakub@redhat.com
Thu Jun 5 15:42:00 GMT 2008


Hi!

This patch contains 2 small changes I needed for the OpenMP 3.0 support.

I need outer_curly_brace_block in cp-gimplify.c's
cxx_omp_predetermined_sharing to properly implement the data sharing
rules, because NRV doesn't preserve type qualification of user defined
variables.  The standard requirement is:
"Variables with const-qualified type having no mutable member are shared."
and obviously relying on TREE_READONLY on the VAR_DECLs is unreliable for
it.
For more details see
http://gcc.gnu.org/ml/gcc-patches/2008-05/msg01184.html

The cp_parser_binary_expression change is to avoid duplicating
too much code to be able to properly parse #pragma omp for with
random access iterator.
For more details see
http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00261.html
cp_parser_binary_expression has just one caller so far, so I hope
the added argument is not a big deal, if it is, one alternative
could be e.g. to rename the cp_parser_binary_expression function
to something else with the added argument and add an
inline wrapper called cp_parser_binary_expression which would
pass PREC_NOT_OPERATOR as the last argument.

Ok for trunk?

2008-06-05  Jakub Jelinek  <jakub@redhat.com>

	* parser.c (cp_parser_binary_expression): Add prec argument.
	(cp_parser_assignment_expression): Adjust caller.
	* cp-tree.h (outer_curly_brace_block): New prototype.
	* decl.c (outer_curly_brace_block): No longer static.

--- gcc/cp/parser.c	(.../trunk)	(revision 136314)
+++ gcc/cp/parser.c	(.../branches/gomp-3_0-branch)	(revision 136352)
@@ -1611,7 +1611,7 @@ static tree cp_parser_delete_expression
 static tree cp_parser_cast_expression
   (cp_parser *, bool, bool);
 static tree cp_parser_binary_expression
-  (cp_parser *, bool);
+  (cp_parser *, bool, enum cp_parser_prec);
 static tree cp_parser_question_colon_clause
   (cp_parser *, tree);
 static tree cp_parser_assignment_expression
@@ -6008,14 +6008,15 @@ cp_parser_cast_expression (cp_parser *pa
  : binops_by_token[token->type].prec)
 
 static tree
-cp_parser_binary_expression (cp_parser* parser, bool cast_p)
+cp_parser_binary_expression (cp_parser* parser, bool cast_p,
+			     enum cp_parser_prec prec)
 {
   cp_parser_expression_stack stack;
   cp_parser_expression_stack_entry *sp = &stack[0];
   tree lhs, rhs;
   cp_token *token;
   enum tree_code tree_type, lhs_type, rhs_type;
-  enum cp_parser_prec prec = PREC_NOT_OPERATOR, new_prec, lookahead_prec;
+  enum cp_parser_prec new_prec, lookahead_prec;
   bool overloaded_p;
 
   /* Parse the first expression.  */
@@ -6192,7 +6193,7 @@ cp_parser_assignment_expression (cp_pars
   else
     {
       /* Parse the binary expressions (logical-or-expression).  */
-      expr = cp_parser_binary_expression (parser, cast_p);
+      expr = cp_parser_binary_expression (parser, cast_p, PREC_NOT_OPERATOR);
       /* If the next token is a `?' then we're actually looking at a
 	 conditional-expression.  */
       if (cp_lexer_next_token_is (parser->lexer, CPP_QUERY))
--- gcc/cp/decl.c	(.../trunk)	(revision 136314)
+++ gcc/cp/decl.c	(.../branches/gomp-3_0-branch)	(revision 136352)
@@ -11759,7 +11759,7 @@ finish_function_body (tree compstmt)
    of curly braces, skipping the artificial block created for constructor
    initializers.  */
 
-static tree
+tree
 outer_curly_brace_block (tree fndecl)
 {
   tree block = BLOCK_SUBBLOCKS (DECL_INITIAL (fndecl));
--- gcc/cp/cp-tree.h	(.../trunk)	(revision 136314)
+++ gcc/cp/cp-tree.h	(.../branches/gomp-3_0-branch)	(revision 136352)
@@ -4235,6 +4235,7 @@ extern void start_preparsed_function		(t
 extern int start_function			(cp_decl_specifier_seq *, const cp_declarator *, tree);
 extern tree begin_function_body			(void);
 extern void finish_function_body		(tree);
+extern tree outer_curly_brace_block		(tree);
 extern tree finish_function			(int);
 extern tree start_method			(cp_decl_specifier_seq *, const cp_declarator *, tree);
 extern tree finish_method			(tree);

	Jakub



More information about the Gcc-patches mailing list