Skip to content

Commit 1017dde

Browse files
NinaRannsiains
authored andcommitted
removing inherited from c-common
1 parent 0a7168d commit 1017dde

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
@@ -31865,10 +31865,6 @@ cp_parse_inherited_contract (cp_parser *parser)
3186531865
{
3186631866
cp_token *token = cp_lexer_consume_token (parser->lexer);
3186731867
location_t loc = token->location;
31868-
31869-
gcc_checking_assert(token->type == CPP_KEYWORD
31870-
&& token->keyword == RID_INHERITED);
31871-
3187231868
matching_parens parens;
3187331869
parens.require_open (parser);
3187431870

@@ -31877,9 +31873,10 @@ cp_parse_inherited_contract (cp_parser *parser)
3187731873
error_at (loc, "inherited contracts are only available with"
3187831874
" %<-fcontracts-on-virtual-functions=P3653%>");
3187931875

31880-
cp_parser_skip_to_closing_parenthesis_1 (parser, /*recovering=*/true,
31881-
CPP_CLOSE_PAREN,
31882-
/*consume_paren=*/true);
31876+
cp_parser_skip_to_closing_parenthesis (parser,
31877+
/*recovering=*/true,
31878+
/*or_comma=*/false,
31879+
/*consume_paren=*/true);
3188331880
return error_mark_node;
3188431881
}
3188531882

@@ -31945,7 +31942,8 @@ cp_parser_function_contract_specifier (cp_parser *parser)
3194531942

3194631943
token = cp_lexer_peek_token (parser->lexer);
3194731944

31948-
if (token->type == CPP_KEYWORD && token->keyword == RID_INHERITED)
31945+
if (token->type == CPP_NAME
31946+
&& is_attribute_p ("inherited", token->u.value))
3194931947
return cp_parse_inherited_contract(parser);
3195031948

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

0 commit comments

Comments
 (0)