2018-11-09 Jakub Jelinek <jakub@redhat.com>
+ * c-parser.c (c_parser_omp_clause_final): Use
+ c_parser_expr_no_commas, convert_lvalue_to_rvalue,
+ c_objc_common_truthvalue_conversion, c_fully_fold and parentheses
+ parsing instead of c_parser_paren_condition.
+ (c_parser_omp_clause_if): Use c_parser_expr_no_commas,
+ convert_lvalue_to_rvalue, c_objc_common_truthvalue_conversion and
+ c_fully_fold instead of c_parser_condition.
+ (c_parser_omp_clause_num_threads, c_parser_omp_clause_num_tasks,
+ c_parser_omp_clause_grainsize, c_parser_omp_clause_priority,
+ c_parser_omp_clause_hint, c_parser_omp_clause_num_teams,
+ c_parser_omp_clause_thread_limit, c_parser_omp_clause_linear): Use
+ c_parser_expr_no_commas instead of c_parser_expression.
+
* c-parser.c (c_parser_omp_clause_reduction): Call sorry_at on
reduction clause with inscan modifier.
location_t loc = c_parser_peek_token (parser)->location;
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
{
- tree t = c_parser_paren_condition (parser);
- tree c;
+ matching_parens parens;
+ tree t, c;
+ if (!parens.require_open (parser))
+ t = error_mark_node;
+ else
+ {
+ location_t eloc = c_parser_peek_token (parser)->location;
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
+ t = convert_lvalue_to_rvalue (eloc, expr, true, true).value;
+ t = c_objc_common_truthvalue_conversion (eloc, t);
+ t = c_fully_fold (t, false, NULL);
+ parens.skip_until_found_close (parser);
+ }
check_no_duplicate_clause (list, OMP_CLAUSE_FINAL, "final");
}
}
- tree t = c_parser_condition (parser), c;
+ location_t loc = c_parser_peek_token (parser)->location;
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
+ expr = convert_lvalue_to_rvalue (loc, expr, true, true);
+ tree t = c_objc_common_truthvalue_conversion (loc, expr.value), c;
+ t = c_fully_fold (t, false, NULL);
parens.skip_until_found_close (parser);
for (c = list; c ; c = OMP_CLAUSE_CHAIN (c))
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
if (parens.require_open (parser))
{
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
tree c, t = expr.value;
t = c_fully_fold (t, false, NULL);
{
c_parser_consume_token (parser);
location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr expr = c_parser_expression (parser);
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
step = expr.value;
step = c_fully_fold (step, false, NULL);
2018-11-09 Jakub Jelinek <jakub@redhat.com>
+ * parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
+ cp_parser_assignment_expression instead of cp_parser_condition.
+ (cp_parser_omp_clause_num_threads, cp_parser_omp_clause_num_tasks,
+ cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority,
+ cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
+ cp_parser_omp_clause_linear, cp_parser_omp_clause_device): Use
+ cp_parser_assignment_expression instead of cp_parser_expression.
+ (cp_parser_omp_clause_hint): Likewise. Formatting fix.
+
* parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
reduction clause with inscan modifier.
if (!parens.require_open (parser))
return list;
- t = cp_parser_condition (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
}
}
- t = cp_parser_condition (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
hint ( expression ) */
static tree
-cp_parser_omp_clause_hint (cp_parser *parser, tree list,
- location_t location)
+cp_parser_omp_clause_hint (cp_parser *parser, tree list, location_t location)
{
tree t, c;
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
step = NULL_TREE;
}
if (!step)
- step = cp_parser_expression (parser);
+ step = cp_parser_assignment_expression (parser);
if (!parens.require_close (parser))
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
if (!parens.require_open (parser))
return list;
- t = cp_parser_expression (parser);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node
|| !parens.require_close (parser))
2018-11-09 Jakub Jelinek <jakub@redhat.com>
+ * c-c++-common/gomp/clauses-5.c: New test.
+
* c-c++-common/gomp/requires-1.c: Prune not supported yet messages.
* c-c++-common/gomp/requires-2.c: Likewise.
* c-c++-common/gomp/requires-4.c: Likewise.
--- /dev/null
+void
+foo (int *p)
+{
+ int i, j = 0;
+ #pragma omp parallel if (2, 1) /* { dg-error "expected" } */
+ ;
+ #pragma omp parallel num_threads (3, 4) /* { dg-error "expected" } */
+ ;
+ #pragma omp teams num_teams (4, 5) /* { dg-error "expected" } */
+ ;
+ #pragma omp teams thread_limit (6, 7) /* { dg-error "expected" } */
+ ;
+ #pragma omp for linear (j : 8, 9) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ j += (8, 9);
+ #pragma omp for schedule (static, 3, 4) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp for collapse (1, 1) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp for ordered (1, 1) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp simd safelen (3, 4) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp simd simdlen (4, 8) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp simd aligned (p: 4, 8) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp teams
+ #pragma omp distribute dist_schedule (static, 6, 7) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp task final (8, 1) /* { dg-error "expected" } */
+ ;
+ #pragma omp task priority (2, 3) /* { dg-error "expected" } */
+ ;
+ #pragma omp taskloop grainsize (4, 5) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp taskloop num_tasks (5, 6) /* { dg-error "expected" } */
+ for (i = 0; i < 30; i++)
+ ;
+ #pragma omp target device (5, 1) /* { dg-error "expected" } */
+ ;
+ #pragma omp critical (baz) hint (2, 3) /* { dg-error "expected" } */
+ ;
+}