aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2019-07-12 09:49:51 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-07-12 09:49:51 +0200
commit1fdd6f0412922eb7438cbbadbb805fce8cc77485 (patch)
treef268df4071188f1117530ba47efd9179378fd239 /gcc/cp/parser.c
parent3362737705972ba59976909b9dbff31615a1021a (diff)
downloadgcc-1fdd6f0412922eb7438cbbadbb805fce8cc77485.zip
gcc-1fdd6f0412922eb7438cbbadbb805fce8cc77485.tar.gz
gcc-1fdd6f0412922eb7438cbbadbb805fce8cc77485.tar.bz2
tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ORDER.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ORDER. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add order clause entries. (walk_tree_1): Handle OMP_CLAUSE_ORDER. * tree-pretty-print.c (dump_omp_clause): Likewise. * gimplify.c (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Likewise. * omp-low.c (scan_sharing_clauses): Likewise. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. c-family/ * c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ORDER. * c-omp.c (c_omp_split_clauses): Handle splitting of OMP_CLAUSE_ORDER. c/ * c-parser.c (c_parser_omp_clause_name): Handle order clause. (c_parser_omp_clause_order): New function. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER. (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_ORDER. * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ORDER. cp/ * parser.c (cp_parser_omp_clause_name): Handle order clause. (cp_parser_omp_clause_order): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER. (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_ORDER. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER. * pt.c (tsubst_omp_clauses): Likewise. testsuite/ * c-c++-common/gomp/order-1.c: New test. * c-c++-common/gomp/order-2.c: New test. From-SVN: r273431
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1281410..c46740a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -32528,6 +32528,8 @@ cp_parser_omp_clause_name (cp_parser *parser)
case 'o':
if (!strcmp ("ordered", p))
result = PRAGMA_OMP_CLAUSE_ORDERED;
+ else if (!strcmp ("order", p))
+ result = PRAGMA_OMP_CLAUSE_ORDER;
break;
case 'p':
if (!strcmp ("parallel", p))
@@ -33919,6 +33921,50 @@ cp_parser_omp_clause_defaultmap (cp_parser *parser, tree list,
return list;
}
+/* OpenMP 5.0:
+ order ( concurrent ) */
+
+static tree
+cp_parser_omp_clause_order (cp_parser *parser, tree list, location_t location)
+{
+ tree c, id;
+ const char *p;
+
+ matching_parens parens;
+ if (!parens.require_open (parser))
+ return list;
+
+ if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ {
+ cp_parser_error (parser, "expected %<concurrent%>");
+ goto out_err;
+ }
+ else
+ {
+ id = cp_lexer_peek_token (parser->lexer)->u.value;
+ p = IDENTIFIER_POINTER (id);
+ }
+ if (strcmp (p, "concurrent") != 0)
+ {
+ cp_parser_error (parser, "expected %<concurrent%>");
+ goto out_err;
+ }
+ cp_lexer_consume_token (parser->lexer);
+ if (!parens.require_close (parser))
+ goto out_err;
+
+ /* check_no_duplicate_clause (list, OMP_CLAUSE_ORDER, "order", location); */
+ c = build_omp_clause (location, OMP_CLAUSE_ORDER);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+
+ out_err:
+ cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
+ /*or_comma=*/false,
+ /*consume_paren=*/true);
+ return list;
+}
+
/* OpenMP 2.5:
ordered
@@ -35510,7 +35556,8 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "mergeable";
break;
case PRAGMA_OMP_CLAUSE_NOWAIT:
- clauses = cp_parser_omp_clause_nowait (parser, clauses, token->location);
+ clauses = cp_parser_omp_clause_nowait (parser, clauses,
+ token->location);
c_name = "nowait";
break;
case PRAGMA_OMP_CLAUSE_NUM_TASKS:
@@ -35523,6 +35570,11 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
token->location);
c_name = "num_threads";
break;
+ case PRAGMA_OMP_CLAUSE_ORDER:
+ clauses = cp_parser_omp_clause_order (parser, clauses,
+ token->location);
+ c_name = "order";
+ break;
case PRAGMA_OMP_CLAUSE_ORDERED:
clauses = cp_parser_omp_clause_ordered (parser, clauses,
token->location);
@@ -37560,7 +37612,8 @@ cp_omp_split_clauses (location_t loc, enum tree_code code,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IF) \
- | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONTEMPORAL))
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONTEMPORAL) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
static tree
cp_parser_omp_simd (cp_parser *parser, cp_token *pragma_tok,
@@ -37620,7 +37673,8 @@ cp_parser_omp_simd (cp_parser *parser, cp_token *pragma_tok,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDERED) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT) \
- | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE))
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
static tree
cp_parser_omp_for (cp_parser *parser, cp_token *pragma_tok,