From 0bd514107de7b0f643aa72554b3bdb5aeb5aa0f5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 6 Sep 2022 09:24:13 +0200 Subject: openmp: Be consistent on parsing offsets between normal sink vector and omp_cur_iteration - 1 For normal sink vectors, we just check that the token is CPP_NUMBER and with INTEGER_CST value, while for omp_cur_iteration I was additionally requiring integer_type_node type (so only 1, 001, 0x0001 but not 1L or 1ULL etc.). I think we need to clarify what we actually should allow in the standard, until then it is better to be consistent. 2022-09-06 Jakub Jelinek gcc/c/ * c-parser.cc (c_parser_omp_clause_doacross_sink): Don't verify val in omp_cur_iteration - 1 has integer_type_node type. gcc/cp/ * parser.cc (cp_parser_omp_clause_doacross_sink): Don't verify val in omp_cur_iteration - 1 has integer_type_node type. gcc/testsuite/ * c-c++-common/gomp/doacross-6.c (corge): Don't expect an error here. Add a few further tests. --- gcc/c/c-parser.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 65d73a6..72db5b5 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -15993,8 +15993,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); -- cgit v1.1 From 25aeb92221659067b5d83c6ca1639374ce9be555 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 7 Sep 2022 00:17:51 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index a97faa6..f0c4971 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2022-09-06 Jakub Jelinek + + * 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 * c-parser.cc (c_parser_omp_clause_name): Handle doacross. -- cgit v1.1 From 0a91bdaf177409a2a5e7895bce4f0e7091b4b3ca Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 7 Sep 2022 13:56:25 +0000 Subject: c: New C2x keywords C2x follows C++ in making alignas, alignof, bool, false, static_assert, thread_local and true keywords; implement this accordingly. This implementation makes them normal keywords in C2x mode just like any other keyword (C2x leaves open the possibility of implementation using predefined macros instead - thus, there aren't any testcases asserting that they aren't macros). As in C++ and previous versions of C, true and false are handled like signed 1 and 0 in #if (there was an intermediate state in some C2x drafts where they had different macro expansions that were unsigned in #if). Bootstrapped with no regressions for x86_64-pc-linux-gnu. As with the removal of unprototyped functions, this change has a high risk of breaking some old code and people doing GNU/Linux distribution builds may wish to see how much is broken in a build with a -std=gnu2x default. gcc/ * ginclude/stdalign.h [defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L]: Disable all content. * ginclude/stdbool.h [defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L] (bool, true, false): Do not define. gcc/c-family/ * c-common.cc (c_common_reswords): Use D_C2X instead of D_CXXONLY for alignas, alignof, bool, false, static_assert, thread_local and true. gcc/c/ * 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. gcc/testsuite/ * gcc.dg/c11-keywords-1.c, gcc.dg/c2x-align-1.c, gcc.dg/c2x-align-6.c, gcc.dg/c2x-bool-2.c, gcc.dg/c2x-static-assert-3.c, gcc.dg/c2x-static-assert-4.c, gcc.dg/c2x-thread-local-1.c: New tests. * gcc.dg/c2x-bool-1.c: Update expectations. libcpp/ * include/cpplib.h (struct cpp_options): Add true_false. * expr.cc (eval_token): Check true_false not cplusplus to determine whether to handle true and false keywords. * init.cc (struct lang_flags): Add true_false. (lang_defaults): Update. (cpp_set_lang): Set true_false. --- gcc/c/c-parser.cc | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 72db5b5..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 (); -- cgit v1.1 From fe2a8ce93c86e05730ee9b975f413cb3fc288d94 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 8 Sep 2022 00:18:33 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index f0c4971..41dc86b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2022-09-07 Joseph Myers + + * 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 * c-parser.cc (c_parser_omp_clause_doacross_sink): Don't verify val -- cgit v1.1