From 22d8d6160281e66502cc39f5496119250f2b929c Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Wed, 3 Nov 2010 13:39:39 +0000 Subject: In gcc/: 2010-11-03 Nicola Pero In gcc/: 2010-11-03 Nicola Pero Implemented -fobjc-std=objc1 flag. * doc/invoke.texi (Option Summary): Document -fobjc-std=objc1 option. * doc/standards.texi (Standards): Updated the section on Objective-C; mention support for Objective-C 2.0 features and the new -fstd-objc=objc1 flag to disable them. In gcc/c-family/: 2010-11-03 Nicola Pero Implemented -fobjc-std=objc1 flag. * c.opt (fobjc-std=objc1): New option. In gcc/objc/: 2010-11-03 Nicola Pero Implemented -fobjc-std=objc1 flag. * objc-act.c (objc_start_class_interface): If attributes are specified when flag_objc1_only is set, print an error. (objc_start_category_interface): Same change. (objc_start_protocol): Same change. (objc_add_method_declaration): Same change. (objc_start_method_definition): Same change. (objc_build_keyword_decl): Same change. (objc_set_method_opt): If flag_objc1_only is set, print an error. (objc_add_property_declaration): Same change. (objc_add_synthesize_declaration): Same change. (objc_add_dynamic_declaration): Same change. (objc_finish_foreach_loop): Same change. (objc_maybe_build_component_ref): If flag_objc1_only is set, return immediately. In gcc/testsuite/: 2010-11-03 Nicola Pero Implemented -fobjc-std=objc1 flag. * objc.dg/fobjc-std-1.m: New. * obj-c++.dg/fobjc-std-1.mm: New. From-SVN: r166246 --- gcc/objc/ChangeLog | 20 ++++++++++++++++ gcc/objc/objc-act.c | 66 +++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 10 deletions(-) (limited to 'gcc/objc') diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 1d78c0c8c2f..61c5a961c3d 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,23 @@ +2010-11-03 Nicola Pero + + Implemented -fobjc-std=objc1 flag. + * objc-act.c (objc_start_class_interface): If attributes are + specified when flag_objc1_only is set, print an error. + (objc_start_category_interface): Same change. + (objc_start_protocol): Same change. + (objc_add_method_declaration): Same change. + (objc_start_method_definition): Same change. + (objc_build_keyword_decl): Same change. + (objc_set_visibility): If OBJC_IVAR_VIS_PACKAGE is used when + flag_objc1_set is set, print an error. + (objc_set_method_opt): If flag_objc1_only is set, print an error. + (objc_add_property_declaration): Same change. + (objc_add_synthesize_declaration): Same change. + (objc_add_dynamic_declaration): Same change. + (objc_finish_foreach_loop): Same change. + (objc_maybe_build_component_ref): If flag_objc1_only is set, + return immediately. + 2010-11-03 Nicola Pero * objc-act.c (maybe_make_artificial_property_decl): New. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index cfbcb3c6826..1c97f46775f 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -686,9 +686,14 @@ objc_start_class_interface (tree klass, tree super_class, tree protos, tree attributes) { if (attributes) - warning_at (input_location, OPT_Wattributes, - "class attributes are not available in this version" - " of the compiler, (ignored)"); + { + if (flag_objc1_only) + error_at (input_location, "class attributes are not available in Objective-C 1.0"); + else + warning_at (input_location, OPT_Wattributes, + "class attributes are not available in this version" + " of the compiler, (ignored)"); + } objc_interface_context = objc_ivar_context = start_class (CLASS_INTERFACE_TYPE, klass, super_class, protos); @@ -700,9 +705,14 @@ objc_start_category_interface (tree klass, tree categ, tree protos, tree attributes) { if (attributes) - warning_at (input_location, OPT_Wattributes, - "category attributes are not available in this version" - " of the compiler, (ignored)"); + { + if (flag_objc1_only) + error_at (input_location, "category attributes are not available in Objective-C 1.0"); + else + warning_at (input_location, OPT_Wattributes, + "category attributes are not available in this version" + " of the compiler, (ignored)"); + } objc_interface_context = start_class (CATEGORY_INTERFACE_TYPE, klass, categ, protos); objc_ivar_chain @@ -713,9 +723,14 @@ void objc_start_protocol (tree name, tree protos, tree attributes) { if (attributes) - warning_at (input_location, OPT_Wattributes, - "protocol attributes are not available in this version" - " of the compiler, (ignored)"); + { + if (flag_objc1_only) + error_at (input_location, "protocol attributes are not available in Objective-C 1.0"); + else + warning_at (input_location, OPT_Wattributes, + "protocol attributes are not available in this version" + " of the compiler, (ignored)"); + } objc_interface_context = start_protocol (PROTOCOL_INTERFACE_TYPE, name, protos); objc_method_optional_flag = false; @@ -783,13 +798,21 @@ void objc_set_visibility (objc_ivar_visibility_kind visibility) { if (visibility == OBJC_IVAR_VIS_PACKAGE) - warning (0, "%<@package%> presently has the same effect as %<@public%>"); + { + if (flag_objc1_only) + error ("%<@package%> is not available in Objective-C 1.0"); + else + warning (0, "%<@package%> presently has the same effect as %<@public%>"); + } objc_ivar_visibility = visibility; } void objc_set_method_opt (bool optional) { + if (flag_objc1_only) + error_at (input_location, "@optional/@required are not available in Objective-C 1.0"); + objc_method_optional_flag = optional; if (!objc_interface_context || TREE_CODE (objc_interface_context) != PROTOCOL_INTERFACE_TYPE) @@ -827,6 +850,9 @@ objc_add_property_declaration (location_t location, tree decl, bool property_readonly = false; objc_property_assign_semantics property_assign_semantics = OBJC_PROPERTY_ASSIGN; + if (flag_objc1_only) + error_at (input_location, "%<@property%> is not available in Objective-C 1.0"); + if (parsed_property_readonly && parsed_property_readwrite) { error_at (location, "% attribute conflicts with % attribute"); @@ -1155,6 +1181,11 @@ objc_maybe_build_component_ref (tree object, tree property_ident) tree x = NULL_TREE; tree rtype; + /* If we are in Objective-C 1.0 mode, properties are not + available. */ + if (flag_objc1_only) + return NULL_TREE; + /* Try to determine quickly if 'object' is an Objective-C object or not. If not, return. */ if (object == NULL_TREE || object == error_mark_node @@ -1346,6 +1377,9 @@ objc_add_method_declaration (bool is_class_method, tree decl, tree attributes) fatal_error ("method declaration not in @interface context"); } + if (flag_objc1_only && attributes) + error_at (input_location, "method attributes are not available in Objective-C 1.0"); + objc_decl_method_attributes (&decl, attributes, 0); objc_add_method (objc_interface_context, decl, @@ -6632,6 +6666,9 @@ objc_build_keyword_decl (tree key_name, tree arg_type, { tree keyword_decl; + if (flag_objc1_only && attributes) + error_at (input_location, "method argument attributes are not available in Objective-C 1.0"); + /* If no type is specified, default to "id". */ arg_type = adjust_type_for_id_default (arg_type); @@ -9339,6 +9376,9 @@ objc_add_synthesize_declaration (location_t location, tree property_and_ivar_lis { tree interface, chain; + if (flag_objc1_only) + error_at (input_location, "%<@synthesize%> is not available in Objective-C 1.0"); + if (property_and_ivar_list == error_mark_node) return; @@ -9459,6 +9499,9 @@ objc_add_dynamic_declaration (location_t location, tree property_list) { tree interface, chain; + if (flag_objc1_only) + error_at (input_location, "%<@dynamic%> is not available in Objective-C 1.0"); + if (property_list == error_mark_node) return; @@ -12163,6 +12206,9 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll tree t; int i; + if (flag_objc1_only) + error_at (location, "fast enumeration is not available in Objective-C 1.0"); + if (object_expression == error_mark_node) return; -- cgit v1.2.1