summaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authoriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 16:51:00 +0000
committeriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 16:51:00 +0000
commit069761fbf4b005ff86f4e2bc2b53e70efaf5b89f (patch)
tree42ebcaff8a7ee59b29d662bbc60c7b6727371ef5 /gcc/c-parser.c
parentc02c1386ee1914333a33ccaa3b7b43c1d25ce974 (diff)
downloadgcc-069761fbf4b005ff86f4e2bc2b53e70efaf5b89f.tar.gz
add @optional/@required to prto lists
gcc: * c-parser.c (c_parser_objc_methodprotolist): Amend preceding comment, parse @optional/@required and set the flags as appropriate. gcc/c-family: * c-common.c: Add two new entries for @optional and @required keywords. merge from FSF 'apple/trunk' branch. 2006-01-30 Fariborz Jahanian <fjahanian@apple.com> Radar 4386773 * c-common.h (RID_AT_OPTIONAL, RID_AT_REQUIRED): Two new objective-c keywords. (objc_set_method_opt): New declaration. * stub-objc.c (objc_set_method_opt): New stub. gcc/cp: merge from FSF 'apple/trunk' branch. 2006-01-30 Fariborz Jahanian <fjahanian@apple.com> Radar 4386773 * cp/parser.c (cp_parser_objc_interstitial_code): For @optional/@required set the optional/required flag. gcc/objc: merge from FSF 'apple/trunk' branch. 2006-01-30 Fariborz Jahanian <fjahanian@apple.com> Radar 4386773 * objc/objc-act.c (objc_set_method_opt): New function. (objc_start_protocol, objc_finish_interface): Reset objc_method_optional_flag flag. (objc_add_method_declaration): Pass on the new flag to objc_add_method. (objc_add_method): Add optional methods to new chain in the protocol class. * objc/objc-act.h (CLASS_OPTIONAL_CLS_METHODS, CLASS_OPTIONAL_NST_METHODS): New macros accessing a protocol class's optional method chains. testsuite: merge from FSF 'apple/trunk' branch. 2006-01-30 Fariborz Jahanian <fjahanian@apple.com> Radar 4386773 * objc.dg/enhanced-proto-1.m: New. * objc.dg/enhanced-proto-2.m: New. * obj-c++.dg/enhanced-proto-1.mm: New * obj-c++.dg/enhanced-proto-2.mm: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164754 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r--gcc/c-parser.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 564077449e4..dc5ea8d52ec 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -6743,6 +6743,8 @@ c_parser_objc_method_definition (c_parser *parser)
objc-methodprotolist objc-methodproto
objc-methodprotolist declaration
objc-methodprotolist ;
+ @optional
+ @required
The declaration is a data definition, which may be missing
declaration specifiers under the same rules and diagnostics as
@@ -6775,7 +6777,18 @@ c_parser_objc_methodprotolist (c_parser *parser)
default:
if (c_parser_next_token_is_keyword (parser, RID_AT_END))
return;
- c_parser_declaration_or_fndef (parser, false, false, true,
+ else if (c_parser_next_token_is_keyword (parser, RID_AT_OPTIONAL))
+ {
+ objc_set_method_opt (true);
+ c_parser_consume_token (parser);
+ }
+ else if (c_parser_next_token_is_keyword (parser, RID_AT_REQUIRED))
+ {
+ objc_set_method_opt (false);
+ c_parser_consume_token (parser);
+ }
+ else
+ c_parser_declaration_or_fndef (parser, false, false, true,
false, true);
break;
}