aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-21 14:32:26 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-21 14:32:26 -0700
commita5b5cabc91c38710adbe5c8a2b53882abe994441 (patch)
tree66b099a6ebc2076ef353afa90d9703824d023812 /gcc/c
parenta0791d0ed4f147ef347e83f4aedc7ad03f1a2008 (diff)
parent09e18d113b3c3dae896ac1a8ad1e0087adbb153b (diff)
downloadgcc-a5b5cabc91c38710adbe5c8a2b53882abe994441.zip
gcc-a5b5cabc91c38710adbe5c8a2b53882abe994441.tar.gz
gcc-a5b5cabc91c38710adbe5c8a2b53882abe994441.tar.bz2
Merge from trunk revision 09e18d113b3c3dae896ac1a8ad1e0087adbb153b.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog16
-rw-r--r--gcc/c/c-parser.c56
2 files changed, 66 insertions, 6 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 28fe7bc..794cbe7 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,19 @@
+2021-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ * c-parser.c (c_parser_omp_clause_order): Parse unconstrained
+ and reproducible modifiers.
+ (OMP_DISTRIBUTE_CLAUSE_MASK): Add order clause.
+
+2021-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ * c-parser.c (c_parser_omp_clause_default): Handle private and
+ firstprivate arguments, adjust diagnostics on unknown argument.
+
+2021-09-17 Jakub Jelinek <jakub@redhat.com>
+
+ * c-parser.c (c_parser_omp_atomic): Reject atomic swap if capture
+ is true.
+
2021-09-10 Jakub Jelinek <jakub@redhat.com>
* c-parser.c (c_parser_conditional_expression): If omp_atomic_lhs and
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index eba9bbf..fb1399e 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -13420,6 +13420,9 @@ c_parser_omp_clause_copyprivate (c_parser *parser, tree list)
/* OpenMP 2.5:
default ( none | shared )
+ OpenMP 5.1:
+ default ( private | firstprivate )
+
OpenACC:
default ( none | present ) */
@@ -13446,9 +13449,24 @@ c_parser_omp_clause_default (c_parser *parser, tree list, bool is_oacc)
break;
case 'p':
- if (strcmp ("present", p) != 0 || !is_oacc)
+ if (is_oacc)
+ {
+ if (strcmp ("present", p) != 0)
+ goto invalid_kind;
+ kind = OMP_CLAUSE_DEFAULT_PRESENT;
+ }
+ else
+ {
+ if (strcmp ("private", p) != 0)
+ goto invalid_kind;
+ kind = OMP_CLAUSE_DEFAULT_PRIVATE;
+ }
+ break;
+
+ case 'f':
+ if (strcmp ("firstprivate", p) != 0 || is_oacc)
goto invalid_kind;
- kind = OMP_CLAUSE_DEFAULT_PRESENT;
+ kind = OMP_CLAUSE_DEFAULT_FIRSTPRIVATE;
break;
case 's':
@@ -13469,7 +13487,8 @@ c_parser_omp_clause_default (c_parser *parser, tree list, bool is_oacc)
if (is_oacc)
c_parser_error (parser, "expected %<none%> or %<present%>");
else
- c_parser_error (parser, "expected %<none%> or %<shared%>");
+ c_parser_error (parser, "expected %<none%>, %<shared%>, "
+ "%<private%> or %<firstprivate%>");
}
parens.skip_until_found_close (parser);
@@ -14591,7 +14610,14 @@ c_parser_oacc_clause_wait (c_parser *parser, tree list)
/* OpenMP 5.0:
- order ( concurrent ) */
+ order ( concurrent )
+
+ OpenMP 5.1:
+ order ( order-modifier : concurrent )
+
+ order-modifier:
+ reproducible
+ unconstrained */
static tree
c_parser_omp_clause_order (c_parser *parser, tree list)
@@ -14599,10 +14625,26 @@ c_parser_omp_clause_order (c_parser *parser, tree list)
location_t loc = c_parser_peek_token (parser)->location;
tree c;
const char *p;
+ bool unconstrained = false;
matching_parens parens;
if (!parens.require_open (parser))
return list;
+ if (c_parser_next_token_is (parser, CPP_NAME)
+ && c_parser_peek_2nd_token (parser)->type == CPP_COLON)
+ {
+ p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+ if (strcmp (p, "unconstrained") == 0)
+ unconstrained = true;
+ else if (strcmp (p, "reproducible") != 0)
+ {
+ c_parser_error (parser, "expected %<reproducible%> or "
+ "%<unconstrained%>");
+ goto out_err;
+ }
+ c_parser_consume_token (parser);
+ c_parser_consume_token (parser);
+ }
if (!c_parser_next_token_is (parser, CPP_NAME))
{
c_parser_error (parser, "expected %<concurrent%>");
@@ -14616,8 +14658,9 @@ c_parser_omp_clause_order (c_parser *parser, tree list)
}
c_parser_consume_token (parser);
parens.skip_until_found_close (parser);
- /* check_no_duplicate_clause (list, OMP_CLAUSE_ORDER, "order"); */
+ check_no_duplicate_clause (list, OMP_CLAUSE_ORDER, "order");
c = build_omp_clause (loc, OMP_CLAUSE_ORDER);
+ OMP_CLAUSE_ORDER_UNCONSTRAINED (c) = unconstrained;
OMP_CLAUSE_CHAIN (c) = list;
return c;
@@ -20231,7 +20274,8 @@ c_parser_omp_cancellation_point (c_parser *parser, enum pragma_context context)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)\
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
- | (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
c_parser_omp_distribute (location_t loc, c_parser *parser,