Skip to content

Commit 0b40073

Browse files
NinaRannsiains
authored andcommitted
removing inherited from c-common
1 parent 60e9e97 commit 0b40073

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

gcc/c-family/c-common.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ const struct c_common_resword c_common_reswords[] =
516516
{ "constinit", RID_CONSTINIT, D_CXXONLY | D_CXX20 | D_CXXWARN },
517517
{ "const_cast", RID_CONSTCAST, D_CXXONLY | D_CXXWARN },
518518
{ "continue", RID_CONTINUE, 0 },
519+
{ "contract_assert", RID_CONTASSERT, D_CXXONLY | D_CXXWARN }, // removed D_CXX20 in order for contracts to work out of the box
519520
{ "decltype", RID_DECLTYPE, D_CXXONLY | D_CXX11 | D_CXXWARN },
520521
{ "default", RID_DEFAULT, 0 },
521522
{ "delete", RID_DELETE, D_CXXONLY | D_CXXWARN },
@@ -598,10 +599,6 @@ const struct c_common_resword c_common_reswords[] =
598599
{ "co_yield", RID_CO_YIELD, D_CXX_COROUTINES_FLAGS | D_CXXWARN },
599600
{ "co_return", RID_CO_RETURN, D_CXX_COROUTINES_FLAGS | D_CXXWARN },
600601

601-
/* Contracts-related keywords */
602-
{ "contract_assert", RID_CONTASSERT, D_CXXONLY | D_CXXWARN }, // removed D_CXX20 in order for contracts to work out of the box
603-
{ "inherited", RID_INHERITED, D_CXXONLY | D_CXXWARN },
604-
605602
/* These Objective-C keywords are recognized only immediately after
606603
an '@'. */
607604
{ "compatibility_alias", RID_AT_ALIAS, D_OBJC },

gcc/c-family/c-common.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ enum rid
176176
RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT,
177177

178178
/* C++20 */
179-
RID_CONSTINIT, RID_CONSTEVAL,
179+
RID_CONSTINIT, RID_CONSTEVAL, RID_CONTASSERT,
180180

181181
/* char8_t */
182182
RID_CHAR8,
@@ -190,9 +190,6 @@ enum rid
190190
/* C++ coroutines */
191191
RID_CO_AWAIT, RID_CO_YIELD, RID_CO_RETURN,
192192

193-
/* C++ contracts */
194-
RID_CONTASSERT, RID_INHERITED,
195-
196193
/* C++ transactional memory. */
197194
RID_ATOMIC_NOEXCEPT, RID_ATOMIC_CANCEL, RID_SYNCHRONIZED,
198195

gcc/cp/parser.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31868,10 +31868,6 @@ cp_parse_inherited_contract (cp_parser *parser)
3186831868
{
3186931869
cp_token *token = cp_lexer_consume_token (parser->lexer);
3187031870
location_t loc = token->location;
31871-
31872-
gcc_checking_assert(token->type == CPP_KEYWORD
31873-
&& token->keyword == RID_INHERITED);
31874-
3187531871
matching_parens parens;
3187631872
parens.require_open (parser);
3187731873

@@ -31880,9 +31876,10 @@ cp_parse_inherited_contract (cp_parser *parser)
3188031876
error_at (loc, "inherited contracts are only available with"
3188131877
" %<-fcontracts-on-virtual-functions=P3653%>");
3188231878

31883-
cp_parser_skip_to_closing_parenthesis_1 (parser, /*recovering=*/true,
31884-
CPP_CLOSE_PAREN,
31885-
/*consume_paren=*/true);
31879+
cp_parser_skip_to_closing_parenthesis (parser,
31880+
/*recovering=*/true,
31881+
/*or_comma=*/false,
31882+
/*consume_paren=*/true);
3188631883
return error_mark_node;
3188731884
}
3188831885

@@ -31948,7 +31945,8 @@ cp_parser_function_contract_specifier (cp_parser *parser)
3194831945

3194931946
token = cp_lexer_peek_token (parser->lexer);
3195031947

31951-
if (token->type == CPP_KEYWORD && token->keyword == RID_INHERITED)
31948+
if (token->type == CPP_NAME
31949+
&& is_attribute_p ("inherited", token->u.value))
3195231950
return cp_parse_inherited_contract(parser);
3195331951

3195431952
/* Parse experimental modifiers on C++26 contracts. */

0 commit comments

Comments
 (0)