aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-07-09 10:45:25 +0200
committerJakub Jelinek <jakub@redhat.com>2024-07-09 10:45:25 +0200
commit4f767174b83027091f0e84b4ddb9a6370e549ffd (patch)
tree0f09248a387e9f201acfd73648776895b9507fc5 /gcc/c/c-parser.cc
parent8eab5064d54f41054b6a50d233a1a78a935b1c2a (diff)
downloadgcc-4f767174b83027091f0e84b4ddb9a6370e549ffd.zip
gcc-4f767174b83027091f0e84b4ddb9a6370e549ffd.tar.gz
gcc-4f767174b83027091f0e84b4ddb9a6370e549ffd.tar.bz2
c: Rewrite c_parser_omp_tile_sizes to use c_parser_expr_list
The following patch simplifies c_parser_omp_tile_sizes to use c_parser_expr_list, so that it will get CPP_EMBED parsing naturally, without having another spot that needs to be adjusted for it. 2024-07-09 Jakub Jelinek <jakub@redhat.com> * c-parser.cc (c_parser_omp_tile_sizes): Use c_parser_expr_list. * c-c++-common/gomp/tile-11.c: Adjust expected diagnostics for c. * c-c++-common/gomp/tile-12.c: Likewise.
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r--gcc/c/c-parser.cc25
1 files changed, 9 insertions, 16 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 8c4e697..12c5ed5 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -26431,24 +26431,20 @@ c_parser_omp_tile_sizes (c_parser *parser, location_t loc)
if (!parens.require_open (parser))
return error_mark_node;
- do
- {
- if (sizes && !c_parser_require (parser, CPP_COMMA, "expected %<,%>"))
- return error_mark_node;
-
- location_t expr_loc = c_parser_peek_token (parser)->location;
- c_expr cexpr = c_parser_expr_no_commas (parser, NULL);
- cexpr = convert_lvalue_to_rvalue (expr_loc, cexpr, false, true);
- tree expr = cexpr.value;
+ vec<tree, va_gc> *sizes_vec
+ = c_parser_expr_list (parser, true, true, NULL, NULL, NULL, NULL);
+ sizes = build_tree_list_vec (sizes_vec);
+ release_tree_vector (sizes_vec);
+ for (tree s = sizes; s; s = TREE_CHAIN (s))
+ {
+ tree expr = TREE_VALUE (s);
if (expr == error_mark_node)
{
parens.skip_until_found_close (parser);
return error_mark_node;
}
- expr = c_fully_fold (expr, false, NULL);
-
HOST_WIDE_INT n;
if (!INTEGRAL_TYPE_P (TREE_TYPE (expr))
|| !tree_fits_shwi_p (expr)
@@ -26457,17 +26453,14 @@ c_parser_omp_tile_sizes (c_parser *parser, location_t loc)
{
c_parser_error (parser, "%<sizes%> argument needs positive"
" integral constant");
- expr = integer_one_node;
+ TREE_VALUE (s) = integer_one_node;
}
-
- sizes = tree_cons (NULL_TREE, expr, sizes);
}
- while (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN));
parens.require_close (parser);
gcc_assert (sizes);
tree c = build_omp_clause (loc, OMP_CLAUSE_SIZES);
- OMP_CLAUSE_SIZES_LIST (c) = nreverse (sizes);
+ OMP_CLAUSE_SIZES_LIST (c) = sizes;
return c;
}