From b642fca1c31b2e2175e0860daf32b4ee0d918085 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Wed, 4 Nov 2020 23:52:12 +0000 Subject: Objective-C/C++ : Handle parsing @property 'class' attribute. This attribute states that a property is one manipulated by class methods (it requires a static variable and the setter and getter must be provided explicitly, they cannot be @synthesized). gcc/c-family/ChangeLog: * c-common.h (OBJC_IS_PATTR_KEYWORD): Add class to the list of keywords accepted in @property attribute contexts. * c-objc.h (enum objc_property_attribute_group): Add OBJC_PROPATTR_GROUP_CLASS. (enum objc_property_attribute_kind): Add OBJC_PROPERTY_ATTR_CLASS. gcc/cp/ChangeLog: * parser.c (cp_parser_objc_at_property_declaration): Handle class keywords in @property attribute context. gcc/objc/ChangeLog: * objc-act.c (objc_prop_attr_kind_for_rid): Handle class attribute. (objc_add_property_declaration): Likewise. * objc-act.h (PROPERTY_CLASS): Record class attribute state. gcc/testsuite/ChangeLog: * obj-c++.dg/property/at-property-4.mm: Test handling class attributes. * objc.dg/property/at-property-4.m: Likewise. --- gcc/cp/parser.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/cp/parser.c') diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c4c672e..323d742 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -34052,6 +34052,10 @@ cp_parser_objc_at_property_declaration (cp_parser *parser) enum rid keyword; if (token->type == CPP_NAME) keyword = C_RID_CODE (token->u.value); + else if (token->type == CPP_KEYWORD + && token->keyword == RID_CLASS) + /* Account for accepting the 'class' keyword in this context. */ + keyword = RID_CLASS; else keyword = RID_MAX; /* By definition, an unknown property. */ cp_lexer_consume_token (parser->lexer); -- cgit v1.1