diff options
author | Martin Liska <mliska@suse.cz> | 2022-09-12 10:43:19 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-09-12 10:43:19 +0200 |
commit | fdb97cd0b7d15efa39ba79dca44be93debb0ef12 (patch) | |
tree | 65a6d95503fb9897bda29c72a629e57bb773d1c1 /gcc/c | |
parent | 918bc838c2803f08e4d7ccd179396d48cb8ec804 (diff) | |
parent | 643ae816f17745a77b62188b6bf169211609a59b (diff) | |
download | gcc-fdb97cd0b7d15efa39ba79dca44be93debb0ef12.zip gcc-fdb97cd0b7d15efa39ba79dca44be93debb0ef12.tar.gz gcc-fdb97cd0b7d15efa39ba79dca44be93debb0ef12.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/c/c-parser.cc | 33 |
2 files changed, 35 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index a97faa6..41dc86b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,15 @@ +2022-09-07 Joseph Myers <joseph@codesourcery.com> + + * c-parser.cc (c_parser_static_assert_declaration_no_semi) + (c_parser_alignas_specifier, c_parser_alignof_expression): Allow + for C2x spellings of keywords. + (c_parser_postfix_expression): Handle RID_TRUE and RID_FALSE. + +2022-09-06 Jakub Jelinek <jakub@redhat.com> + + * c-parser.cc (c_parser_omp_clause_doacross_sink): Don't verify val + in omp_cur_iteration - 1 has integer_type_node type. + 2022-09-03 Jakub Jelinek <jakub@redhat.com> * c-parser.cc (c_parser_omp_clause_name): Handle doacross. diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 65d73a6..d134448 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -2630,13 +2630,14 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) tree string = NULL_TREE; gcc_assert (c_parser_next_token_is_keyword (parser, RID_STATIC_ASSERT)); + tree spelling = c_parser_peek_token (parser)->value; assert_loc = c_parser_peek_token (parser)->location; if (flag_isoc99) pedwarn_c99 (assert_loc, OPT_Wpedantic, - "ISO C99 does not support %<_Static_assert%>"); + "ISO C99 does not support %qE", spelling); else pedwarn_c99 (assert_loc, OPT_Wpedantic, - "ISO C90 does not support %<_Static_assert%>"); + "ISO C90 does not support %qE", spelling); c_parser_consume_token (parser); matching_parens parens; if (!parens.require_open (parser)) @@ -2667,7 +2668,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) new C2X feature of _Static_assert. */ pedwarn_c11 (assert_loc, OPT_Wpedantic, "ISO C11 does not support omitting the string in " - "%<_Static_assert%>"); + "%qE", spelling); parens.require_close (parser); if (!INTEGRAL_TYPE_P (TREE_TYPE (value))) @@ -3774,13 +3775,14 @@ c_parser_alignas_specifier (c_parser * parser) tree ret = error_mark_node; location_t loc = c_parser_peek_token (parser)->location; gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS)); + tree spelling = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); if (flag_isoc99) pedwarn_c99 (loc, OPT_Wpedantic, - "ISO C99 does not support %<_Alignas%>"); + "ISO C99 does not support %qE", spelling); else pedwarn_c99 (loc, OPT_Wpedantic, - "ISO C90 does not support %<_Alignas%>"); + "ISO C90 does not support %qE", spelling); matching_parens parens; if (!parens.require_open (parser)) return ret; @@ -8399,10 +8401,12 @@ c_parser_alignof_expression (c_parser *parser) location_t end_loc; tree alignof_spelling = c_parser_peek_token (parser)->value; gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF)); - bool is_c11_alignof = strcmp (IDENTIFIER_POINTER (alignof_spelling), - "_Alignof") == 0; + bool is_c11_alignof = (strcmp (IDENTIFIER_POINTER (alignof_spelling), + "_Alignof") == 0 + || strcmp (IDENTIFIER_POINTER (alignof_spelling), + "alignof") == 0); /* A diagnostic is not required for the use of this identifier in - the implementation namespace; only diagnose it for the C11 + the implementation namespace; only diagnose it for the C11 or C2X spelling because of existing code using the other spellings. */ if (is_c11_alignof) { @@ -10272,6 +10276,16 @@ c_parser_postfix_expression (c_parser *parser) pedwarn_c11 (loc, OPT_Wpedantic, "ISO C does not support %qs before C2X", "nullptr"); break; + case RID_TRUE: + c_parser_consume_token (parser); + expr.value = boolean_true_node; + set_c_expr_source_range (&expr, tok_range); + break; + case RID_FALSE: + c_parser_consume_token (parser); + expr.value = boolean_false_node; + set_c_expr_source_range (&expr, tok_range); + break; default: c_parser_error (parser, "expected expression"); expr.set_error (); @@ -15993,8 +16007,7 @@ c_parser_omp_clause_doacross_sink (c_parser *parser, location_t clause_loc, && c_parser_peek_nth_token (parser, 4)->type == CPP_CLOSE_PAREN) { tree val = c_parser_peek_nth_token (parser, 3)->value; - if (integer_onep (val) - && comptypes (TREE_TYPE (val), integer_type_node)) + if (integer_onep (val)) { c_parser_consume_token (parser); c_parser_consume_token (parser); |