From: Mike Stump Date: Wed, 4 May 2011 18:25:20 +0000 (+0000) Subject: Fixup whitespacing. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=944fb7998bc4f4d47fa84fda494421da7669d085;p=gcc.git Fixup whitespacing. From-SVN: r173388 --- diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 79e48eb761c..f31a75419a9 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -21,7 +21,7 @@ (objc_detect_field_duplicates): New. (hash_instance_variable): New. (eq_instance_variable): New. - + 2011-04-14 Nicola Pero * objc-act.c (objc_declare_protocols): Renamed to @@ -35,7 +35,7 @@ identifier as argument instead of a tree list. This means callers don't have to build temporary tree lists to call this function. (synth_module_prologue): Updated calls to objc_declare_class. - + 2011-04-13 Nicola Pero * objc-act.c (build_keyword_selector): Use get_identifier_with_length @@ -59,7 +59,7 @@ inefficient temporary argument lists. Compare the arguments directly. (match_proto_with_proto): Removed; incorporated into comp_proto_with_proto (). - + 2011-04-12 Nicola Pero * objc-act.c (printable_ivar_name): New. @@ -89,7 +89,7 @@ 2011-02-26 Nicola Pero * objc-act.c (objc_v2_encode_prop_attr): Rewritten. - + 2011-02-23 Nicola Pero * objc-act.c (build_private_template): Do not copy the @@ -250,7 +250,7 @@ hook. Added assert. Use the get_class_super_ref and get_category_super_ref runtime hooks. (objc_v2_encode_prop_attr): New. - + 2011-01-17 Nicola Pero PR objc/47314 @@ -339,7 +339,7 @@ (objc_build_setter_call, objc_build_message_expr, objc_finish_foreach_loop): Updated call to objc_finish_message_expr. - + 2010-12-28 Nicola Pero PR objc/47076 @@ -432,7 +432,7 @@ c-family/c-objc.h. (objc/objc-lang.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. - + 2010-12-02 Joseph Myers * lang-specs.h: Don't handle -ftraditional. @@ -459,7 +459,7 @@ Allow 'make check-objc -j2' * Make-lang.in (lang_checks_parallelized): New. (check_objc_parallelize): New. - + 2010-11-29 Nicola Pero * objc-act.c (start_class): When a class is reimplemented, @@ -500,7 +500,7 @@ readonly properties. (objc_build_class_component_ref): Updated call to maybe_make_artificial_property_decl. - + 2010-11-27 Nicola Pero * objc-act.c (objc_build_struct): Fixed loops that save and @@ -509,7 +509,7 @@ Duplicate TYPE_LANG_SPECIFIC for each type before restoring TYPE_OBJC_INFO. (objc_get_protocol_qualified_type): Updated comments. - + 2010-11-25 Nicola Pero * objc-act.c (objc_build_struct): Install TYPE_OBJC_INTERFACE @@ -554,8 +554,8 @@ class of a category. Recognize the 'deprecated' attribute when starting and interface, and mark the interface with TREE_DEPRECATED if present. Store attributes in the interface. - -2010-11-19 Nicola Pero + +2010-11-19 Nicola Pero * objc-act.c (lookup_protocol): Added 'warn_if_deprecated' argument. If it is 'true' and the protocol is deprecated, emit a @@ -573,7 +573,7 @@ (check_protocol_recursively): Same change. (lookup_and_install_protocols): Same change. * objc-act.h: Updated comments. - + 2010-11-17 Nicola Pero * objc-act.c (lookup_method_in_protocol_list): Search methods in @@ -633,7 +633,7 @@ (objc_add_synthesize_declaration_for_property): Check that the property to synthesize and the instance variable to use have the same type. - + 2010-11-10 Joseph Myers * objc-act.c (objc_init): Use %' in diagnostic. @@ -672,7 +672,7 @@ protocols and superclasses as well. (objc_synthesize_setter): Search for the setter declaration in protocols and superclasses as well. - + 2010-11-08 Nicola Pero * objc-act.c (lookup_property): When checking categories, also @@ -690,7 +690,7 @@ PROPERTY_GETTER_NAME here; this is now done earlier, in objc_add_property_declaration. * objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Added comments. - + 2010-11-06 Nicola Pero Fixed using the Objective-C 2.0 dot-syntax with self and super. @@ -715,7 +715,7 @@ * objc-tree.def (PROPERTY_REF): Increased the number of operands from 2 to 3. Updated comments. * objc-act.h (PROPERTY_REF_GETTER_CALL): New. - + 2010-11-06 Iain Sandoe PR target/44981 @@ -725,7 +725,7 @@ 2010-11-04 Nicola Pero - Fixed using the Objective-C 2.0 dot-syntax with class names. + Fixed using the Objective-C 2.0 dot-syntax with class names. * objc-act.c (objc_build_class_component_ref): New. 2010-11-03 Nicola Pero @@ -740,7 +740,7 @@ and do not warn if the property is readonly or if the type is a Class. (objc_finish_foreach_loop): Updated calls to objc_type_valid_for_messaging. - + 2010-11-03 Nicola Pero Implemented -fobjc-std=objc1 flag. @@ -772,7 +772,7 @@ (PROPERTY_HAS_NO_GETTER): New. (PROPERTY_HAS_NO_SETTER): New. * objc-tree.def: Updated comment. - + 2010-11-01 Nicola Pero Implemented format and noreturn attributes for Objective-C methods. @@ -788,16 +788,16 @@ "deprecated". In the case of "format", adjust the arguments. Always process the attributes in the same way no matter if "sentinel" is in the list or not. - + 2010-11-01 Nicola Pero * objc-act.c (objc_maybe_build_component_ref): Warn about using deprecated properties. (objc_maybe_printable_name): Support PROPERTY_DECL. - + 2010-11-01 Nicola Pero - Implemented Objective-C 2.0 property accessors. + Implemented Objective-C 2.0 property accessors. * objc-act.h (enum objc_tree_index): Added OCTI_GET_PROPERTY_DECL, OCTI_SET_PROPERTY_DECL, OCTI_COPY_STRUCT_DECL, OCTI_GET_PROPERTY_STRUCT_DECL and OCTI_SET_PROPERTY_STRUCT_DECL. @@ -814,7 +814,7 @@ work with properties that are not nonatomic, assign properties. (objc_synthesize_setter): Implemented synthesizing setters that work with properties that are not nonatomic, assign properties. - + 2010-10-30 Nicola Pero Implemented Objective-C 2.0 @property, @synthesize and @dynamic. @@ -905,7 +905,7 @@ (objc_gimplify_property_ref): New. (objc_gimplify_expr): Use a switch. In case of a PROPERTY_REF, call objc_gimplify_property_ref. - + 2010-10-27 Nicola Pero * objc-act.c (objc_add_property_declaration): Added arguments to @@ -919,10 +919,10 @@ (property_setter): Removed. (property_getter): Removed. (property_ivar): Removed. - (property_copies): Removed. + (property_copies): Removed. (objc_set_property_attr): Removed. * objc-act.h (enum property_assign_semantics): New. - + 2010-10-27 Nicola Pero * objc-act.c (objc_add_property_variable): Renamed to @@ -930,7 +930,7 @@ warnings and errors to use it. Use error, not fatal_error, if a property declaration is found outside an interface or implementation context. - + 2010-10-24 Nicola Pero * objc-act.c (objc_build_keyword_decl): Updated comments. Do not @@ -945,7 +945,7 @@ of DECLs that we don't recognize. Immediately return NULL for them. (objc_printable_name): Removed C++-specific case, which is no longer used. Updated comments. - + 2010-10-23 Nicola Pero * objc-act.c (OBJC_GEN_METHOD_LABEL): Updated comments. @@ -961,7 +961,7 @@ 2010-10-21 Iain Sandoe Based on the CFString implementation in FSF apple/trunk branch. - + * objc/objc-act.c (objc_build_string_object): Handle CFStrings. 2010-10-21 Nicola Pero @@ -990,7 +990,7 @@ twice. Added missing gcc_unreachable for default case - twice. (dump_interface): Use a switch instead of a chain of ifs. (handle_impent): Same change. - + 2010-10-20 Nicola Pero * objc-act.h (objc_inherit_code): Removed. @@ -1006,8 +1006,8 @@ (objc_synthesize_getter): Updated call to objc_start_method_definition. Do not set objc_inherit_code. (objc_synthesize_setter): Updated call to - objc_start_method_definition. Do not set objc_inherit_code. - + objc_start_method_definition. Do not set objc_inherit_code. + 2010-10-20 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. Obvious updates @@ -1023,8 +1023,8 @@ (objc_declare_class): Enter class name into hash table. (objc_is_class_name): Do a hash look up of class name. (hash_init): Initialize the two new hash tables. - * objc-act.h: Added cls_name_hash_list and als_name_hash_list - declarations, removed class_chain and alias_chain. + * objc-act.h: Added cls_name_hash_list and als_name_hash_list + declarations, removed class_chain and alias_chain. 2010-10-20 Nicola Pero @@ -1036,7 +1036,7 @@ for syntax-only run or PCH generation as this is done by the callers. * objc-act.h (objc_finish_file): Removed. - + 2010-10-18 Nicola Pero Implemented parsing @synthesize and @dynamic for @@ -1044,11 +1044,11 @@ * objc-act.c (objc_add_synthesize_declaration): New. (objc_add_dynamic_declaration): New. -2010-10-18 Nicola Pero +2010-10-18 Nicola Pero * objc-act.c (lookup_and_install_protocols): Return NULL if passed error_mark_node. - + 2010-10-18 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. @@ -1059,19 +1059,19 @@ * objc/objc-act.c (objc_is_class_name): template parameter is not an objective class name. (objc_generate_cxx_cdtors): Check for the null - objc_implementation_context. + objc_implementation_context. 2010-10-18 Nicola Pero - Merge from 'apple/trunk' branch on FSF servers. - + Merge from 'apple/trunk' branch on FSF servers. + 2005-11-08 Fariborz Jahanian Radar 4330422 * objc/objc-act.c (objc_non_volatilized_type): New 2005-10-07 Fariborz Jahanian - + Radar 4204796 * objc-act.c (objc_build_volatilized_type): Build 'volatilzed' types with proper attribute set and correctly. @@ -1079,11 +1079,11 @@ (objc_type_quals_match): Use the new attribute to check on 'volatilzed' type. (hash_init): removed unneeded code. - + 2010-10-17 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. - + 2006-03-27 Fariborz Jahanian Radar 4133425 @@ -1092,10 +1092,10 @@ 2010-10-17 Iain Sandoe * objc-act.c: Rename 'objc_public_flag' to objc_ivar_visibility and - make its type 'objc_ivar_visibility_kind'. + make its type 'objc_ivar_visibility_kind'. (objc_start_class_interface): Update to use visibility enum. (objc_start_class_implementation): Likewise. - (objc_set_visibility): Update to use visibility enum, warn that + (objc_set_visibility): Update to use visibility enum, warn that @package is handle as per @public. (add_instance_variable): Handle OBJC_IVAR_VIS_PACKAGE. * objc-act.h: Rename 'objc_public_flag' to objc_ivar_visibility and @@ -1103,9 +1103,9 @@ 2010-10-14 Iain Sandoe - merge from FSF apple 'trunk' branch. + merge from FSF apple 'trunk' branch. 2006 Fariborz Jahanian - + Radars 4436866, 4505126, 4506903, 4517826 * objc-act.c (CALL_EXPR_OBJC_PROPERTY_GETTER): New. property_readonly, property_getter, property_setter, property_ivar, @@ -1153,7 +1153,7 @@ 2010-10-13 Iain Sandoe - merge from FSF apple 'trunk' branch. + merge from FSF apple 'trunk' branch. 2006-04-26 Fariborz Jahanian Radar 3803157 (method attributes) @@ -1180,13 +1180,13 @@ 2010-10-07 Iain Sandoe - * objc-act.c (build_objc_method_call): Replace calls to + * objc-act.c (build_objc_method_call): Replace calls to build_function_call () with the VEC equivalent. Construct parameter lists as VECs. 2010-10-07 Iain Sandoe - * objc-act.c (objc_build_message_expr): Call mark_exp_read () to + * objc-act.c (objc_build_message_expr): Call mark_exp_read () to signal that the receiver has been used. 2010-10-06 Nicola Pero @@ -1220,7 +1220,7 @@ for valid objc object types. (objc_finish_foreach_loop): Check for invalid objc objects in foreach header. - + 2010-10-05 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. @@ -1230,7 +1230,7 @@ Radar 4290840 * objc-act.c (objc_start_method_definition): Check for error_mark_node for the selector name and make a quick exit. - + 2010-10-04 Andi Kleen * Make-lang.in (cc1obj-dummy, cc1obj): Add + to build rule. @@ -1251,7 +1251,7 @@ * objc/objc-act.h (CLASS_OPTIONAL_CLS_METHODS, CLASS_OPTIONAL_NST_METHODS): New macros accessing a protocol class's optional method chains. - + 2010-09-30 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. @@ -1276,8 +1276,8 @@ * objc-act.c (objc_is_reserved_word): Removed. 2010-09-28 Iain Sandoe - - * objc-act.c (objc_add_method_declaration): Handle and ignore + + * objc-act.c (objc_add_method_declaration): Handle and ignore attributes. (objc_start_method_definition): Likewise. (objc_generate_cxx_ctor_or_dtor): Pass NULL attributes to ctor/dtor. @@ -1304,7 +1304,7 @@ * objc-act.c (objc_decay_parm_type): New function. (get_arg_type_list): Decay types for all named arguments. (objc_push_parm): Rebuild the PARM_DECL if its type has - been decayed. + been decayed. 2010-09-28 Nicola Pero @@ -1321,7 +1321,7 @@ * objc-act.c (objc_compare_types): A new silent comparison mode (-4), differing from regular comparison (-3) in that 'false' is returned instead of issuing warnings. - + 2010-09-28 Nicola Pero * objc-act.c (encode_type): Do not add 'r' with the next runtime. @@ -1358,7 +1358,7 @@ Encode C++ reference types as pointers. Call encode_vector to encode vectors. (encode_vector): New function. - + 2010-09-27 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. I modified the @@ -1369,7 +1369,7 @@ Radar 4301047 * objc-act.c (encode_type): Remove the hack. - + 2005-07-20 Ziemowit Laski Radar 4136935 @@ -1385,12 +1385,12 @@ Radar 4229905 * objc-act.c (objc_have_common_types): New function. - + 2005-06-22 Ziemowit Laski Radar 4154928 * objc-act.c (objc_common_type): New function. - + 2010-09-27 Richard Guenther * objc-act.c (objc_get_class_reference): Use CP_TYPE_CONTEXT. @@ -1414,7 +1414,7 @@ * objc-act.c (objc_get_interface_ivars): New function. (objc_collecting_ivars): New variable. (continue_class): Set and reset objc_collecting_ivars for context. - + 2010-09-15 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. @@ -1445,7 +1445,7 @@ * objc-act.c (objc_get_protocol_qualified_type): When looking at a typedef, retrieve the precise type it describes (rather than merely looking up a class by name). - + 2010-09-10 Nicola Pero * objc/objc-act.c (objc_begin_try_stmt): Generate an error if @@ -1461,17 +1461,17 @@ PR objc/44140 * objc-act.c: build_objc_string_decl() remove declaration. (finish_var_decl): Remove forcing of var output and marking - as "Used". - (init_def_list): Use integer_zero_node. + as "Used". + (init_def_list): Use integer_zero_node. (init_objc_symtab): Use integer_zero_node, make the short integer type specific on relevant nodes. - (generate_objc_symtab_decl): Remove call to + (generate_objc_symtab_decl): Remove call to forward_declare_categories(). Use null_pointer_node where - appropriate. - (build_module_descriptor): Comment and mark this item as - DECL_PRESERVE_P. + appropriate. + (build_module_descriptor): Comment and mark this item as + DECL_PRESERVE_P. (generate_static_references): Use gcc_unreachable instead of - abort (). + abort (). (diagnose_missing_method): New. (build_next_selector_translation_table): New. (build_gnu_selector_translation_table): New. @@ -1479,20 +1479,20 @@ ... and delete build_objc_string_decl(). (generate_dispatch_table): Make integer types explicit. (generate_category): Pass implent and arrange for the data - to be extracted within the routine. Do not start new vars, + to be extracted within the routine. Do not start new vars, but finish the ones collcted during parsing. (generate_shared_structures): Likewise. (finish_objc): Reorder code so that we finish variables before referencing them. Save the global data before calling meta-data - creation routines, and pass the current reference to the two - main routines. Only call generate_objc_image_info () for the + creation routines, and pass the current reference to the two + main routines. Only call generate_objc_image_info () for the NeXT runtime. (generate_classref_translation_entry): Comment on and make this item DECL_PRESERVE_P. (handle_class_ref): Use varpool interfaces, comment on and make this item DECL_PRESERVE_P. (handle_impent): Likewise. - (generate_objc_image_info): Only generate when the content is + (generate_objc_image_info): Only generate when the content is non-zero. Make integer types explict. 2010-07-03 Nathan Froyd @@ -1685,10 +1685,10 @@ 2009-07-17 Aldy Hernandez Manuel López-Ibáñez - PR 40435 + PR 40435 * objc-act.c: Add location argument to all calls to build_fold_addr_expr. - + 2009-07-14 Taras Glek Rafael Espindola @@ -1699,23 +1699,23 @@ * objc-act.c (next_sjlj_build_catch_list): Replace EXPR_LOCUS by EXPR_LOCATION. - + 2009-07-07 Manuel López-Ibáñez * objc-act.c: Replace %J by an explicit location. Update all calls. - + 2009-07-07 Manuel López-Ibáñez * objc-act.c: Replace %H by an explicit location. Update all calls. - + 2009-06-22 Steven Bosscher PR objc/28050 * objc-act.c (objc_build_message_args): Return if ARGS is the error_mark_node. - + 2009-06-19 Ian Lance Taylor * objc-act.c (objc_in_struct, objc_struct_types): Remove. @@ -1730,7 +1730,7 @@ label_context_stack_se or label_context_stack_vm. 2009-06-12 Aldy Hernandez - + * objc-act.c (finish_var_decl): Pass location to finish_decl. (objc_get_parm_info): Same. (get_super_receiver): Same. @@ -1756,7 +1756,7 @@ build_modify_expr, build_compound_expr. * objc-act.c: Add location to all calls to start_struct, build_decl, finish_struct. - + 2009-06-09 Ian Lance Taylor * objc-act.c (objc_gimplify_expr): Change return type to int. @@ -2087,11 +2087,11 @@ (add_class): Likewise. 2007-01-02 Douglas Gregor - + * objc-act.c (objc_build_volatilized_type): Keep track of canonical types. (objc_get_protocol_qualified_type): Ditto. - + 2006-11-02 Andreas Tobler * objc-act.c (objc_finish_file): Remove ifdef clause for OBJCPLUS and diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index 182ebf40c33..357028f26ea 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -93,7 +93,7 @@ objc/objc-next-runtime-abi-01.o: objc/objc-next-runtime-abi-01.c $(START_HDRS) \ objc/objc-next-runtime-abi-02.o: objc/objc-next-runtime-abi-02.c $(START_HDRS) \ $(GGC_H) objc/objc-runtime-hooks.h \ objc/objc-next-metadata-tags.h gt-objc-objc-next-runtime-abi-02.h $(TARGET_H) \ - objc/objc-runtime-shared-support.h $(OBSTACK_H) + objc/objc-runtime-shared-support.h $(OBSTACK_H) objc/objc-act.o : objc/objc-act.c $(START_HDRS) $(GGC_H) \ $(DIAGNOSTIC_CORE_H) toplev.h $(FLAGS_H) input.h $(FUNCTION_H) output.h debug.h \ diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 250b3175248..025f37544f9 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -163,7 +163,7 @@ static void objc_generate_cxx_cdtors (void); #endif /* objc attribute */ -static void objc_decl_method_attributes (tree*, tree, int); +static void objc_decl_method_attributes (tree*, tree, int); static tree build_keyword_selector (tree); /* Hash tables to manage the global pool of method prototypes. */ @@ -232,7 +232,7 @@ static tree check_duplicates (hash, int, int); #define OBJC_LOOKUP_NO_SUPER 2 /* Disable returning an instance method of a root class when a class method can't be found. */ -#define OBJC_LOOKUP_NO_INSTANCE_METHODS_OF_ROOT_CLASS 4 +#define OBJC_LOOKUP_NO_INSTANCE_METHODS_OF_ROOT_CLASS 4 /* The OCTI_... enumeration itself is in objc/objc-act.h. */ tree objc_global_trees[OCTI_MAX]; @@ -458,7 +458,7 @@ objc_write_global_declarations (void) /* TODO: consider an early exit here if either errorcount or sorrycount is non-zero. Not only is it wasting time to generate the metadata, - it needlessly imposes need to re-check for things that are already + it needlessly imposes need to re-check for things that are already determined to be errors. */ /* Finalize Objective-C runtime data. No need to generate tables @@ -590,7 +590,7 @@ objc_start_class_interface (tree klass, tree super_class, tree protos, tree attributes) { if (flag_objc1_only && attributes) - error_at (input_location, "class attributes are not available in Objective-C 1.0"); + error_at (input_location, "class attributes are not available in Objective-C 1.0"); objc_interface_context = objc_ivar_context @@ -607,7 +607,7 @@ objc_start_category_interface (tree klass, tree categ, 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, + warning_at (input_location, OPT_Wattributes, "category attributes are not available in this version" " of the compiler, (ignored)"); } @@ -627,7 +627,7 @@ objc_start_category_interface (tree klass, tree categ, as the one we are extending, produce an error. */ if (TREE_CODE (t->imp_context) == CLASS_IMPLEMENTATION_TYPE && IDENTIFIER_POINTER (CLASS_NAME (t->imp_context)) == IDENTIFIER_POINTER (klass)) - error_at (input_location, + error_at (input_location, "class extension for class %qE declared after its %<@implementation%>", klass); } @@ -643,7 +643,7 @@ void objc_start_protocol (tree name, tree protos, tree attributes) { if (flag_objc1_only && attributes) - error_at (input_location, "protocol attributes are not available in Objective-C 1.0"); + error_at (input_location, "protocol attributes are not available in Objective-C 1.0"); objc_interface_context = start_protocol (PROTOCOL_INTERFACE_TYPE, name, protos, attributes); @@ -730,13 +730,13 @@ objc_set_method_opt (bool optional) if (flag_objc1_only) { if (optional) - error_at (input_location, "%<@optional%> is not available in Objective-C 1.0"); + error_at (input_location, "%<@optional%> is not available in Objective-C 1.0"); else - error_at (input_location, "%<@required%> is not available in Objective-C 1.0"); + error_at (input_location, "%<@required%> is not available in Objective-C 1.0"); } objc_method_optional_flag = optional; - if (!objc_interface_context + if (!objc_interface_context || TREE_CODE (objc_interface_context) != PROTOCOL_INTERFACE_TYPE) { if (optional) @@ -808,11 +808,11 @@ lookup_property (tree interface_type, tree property) } /* Failing to find in categories, look for property in protocol list. */ - if (CLASS_PROTOCOL_LIST (inter) + if (CLASS_PROTOCOL_LIST (inter) && (x = lookup_property_in_protocol_list (CLASS_PROTOCOL_LIST (inter), property))) return x; - + /* Failing that, climb up the inheritance hierarchy. */ inter = lookup_interface (CLASS_SUPER_NAME (inter)); } @@ -863,7 +863,7 @@ objc_add_property_declaration (location_t location, tree decl, { if (parsed_property_readonly) property_readonly = true; - + if (parsed_property_readwrite) property_readonly = false; } @@ -915,7 +915,7 @@ objc_add_property_declaration (location_t location, tree decl, if (TREE_CODE (decl) != FIELD_DECL) { error_at (location, "invalid property declaration"); - return; + return; } /* Do some spot-checks for the most obvious invalid types. */ @@ -941,7 +941,7 @@ objc_add_property_declaration (location_t location, tree decl, underlying instance variable could be a bitfield, but that is a different matter. */ error_at (location, "property can not be a bit-field"); - return; + return; } #endif @@ -970,20 +970,20 @@ objc_add_property_declaration (location_t location, tree decl, /* Use 'false' so we do not warn for Class objects. */ if (objc_type_valid_for_messaging (TREE_TYPE (decl), false)) { - warning_at (location, + warning_at (location, 0, - "object property %qD has no %, % or % attribute; assuming %", + "object property %qD has no %, % or % attribute; assuming %", decl); - inform (location, + inform (location, "% can be unsafe for Objective-C objects; please state explicitly if you need it"); } } } - + if (property_assign_semantics == OBJC_PROPERTY_RETAIN && !objc_type_valid_for_messaging (TREE_TYPE (decl), true)) error_at (location, "% attribute is only valid for Objective-C objects"); - + if (property_assign_semantics == OBJC_PROPERTY_COPY && !objc_type_valid_for_messaging (TREE_TYPE (decl), true)) error_at (location, "% attribute is only valid for Objective-C objects"); @@ -1011,7 +1011,7 @@ objc_add_property_declaration (location_t location, tree decl, else { if (!property_readonly) - parsed_property_setter_ident = get_identifier (objc_build_property_setter_name + parsed_property_setter_ident = get_identifier (objc_build_property_setter_name (DECL_NAME (decl))); } @@ -1039,9 +1039,9 @@ objc_add_property_declaration (location_t location, tree decl, else { location_t original_location = DECL_SOURCE_LOCATION (x); - + error_at (location, "redeclaration of property %qD", decl); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -1106,7 +1106,7 @@ objc_add_property_declaration (location_t location, tree decl, { warning_at (location, 0, "'nonatomic' attribute of property %qD conflicts with previous declaration", decl); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -1116,7 +1116,7 @@ objc_add_property_declaration (location_t location, tree decl, { warning_at (location, 0, "'getter' attribute of property %qD conflicts with previous declaration", decl); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -1129,7 +1129,7 @@ objc_add_property_declaration (location_t location, tree decl, { warning_at (location, 0, "'setter' attribute of property %qD conflicts with previous declaration", decl); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -1140,7 +1140,7 @@ objc_add_property_declaration (location_t location, tree decl, { warning_at (location, 0, "assign semantics attributes of property %qD conflict with previous declaration", decl); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -1151,7 +1151,7 @@ objc_add_property_declaration (location_t location, tree decl, { warning_at (location, 0, "'readonly' attribute of property %qD conflicts with previous declaration", decl); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -1183,7 +1183,7 @@ objc_add_property_declaration (location_t location, tree decl, if (!comptypes (TREE_TYPE (x), TREE_TYPE (decl)) /* ... unless the property is readonly, in which case we allow a new, more specialized, declaration. */ - && (!property_readonly + && (!property_readonly || !objc_compare_types (TREE_TYPE (x), TREE_TYPE (decl), -5, NULL_TREE))) { @@ -1213,7 +1213,7 @@ objc_add_property_declaration (location_t location, tree decl, TREE_TYPE (property_decl) = TREE_TYPE (decl); DECL_SOURCE_LOCATION (property_decl) = DECL_SOURCE_LOCATION (decl); TREE_DEPRECATED (property_decl) = TREE_DEPRECATED (decl); - + /* Add property-specific information. */ PROPERTY_NAME (property_decl) = DECL_NAME (decl); PROPERTY_GETTER_NAME (property_decl) = parsed_property_getter_ident; @@ -1253,7 +1253,7 @@ objc_add_property_declaration (location_t location, tree decl, any is found, then create an artificial property that uses them. Return NULL_TREE if 'getter' or 'setter' could not be found. */ static tree -maybe_make_artificial_property_decl (tree interface, tree implementation, +maybe_make_artificial_property_decl (tree interface, tree implementation, tree protocol_list, tree component, bool is_class, tree getter_name) { @@ -1275,7 +1275,7 @@ maybe_make_artificial_property_decl (tree interface, tree implementation, Turn it off. */ if (is_class) flags = OBJC_LOOKUP_CLASS | OBJC_LOOKUP_NO_INSTANCE_METHODS_OF_ROOT_CLASS; - + getter = lookup_method_static (interface, getter_name, flags); setter = lookup_method_static (interface, setter_name, flags); } @@ -1293,7 +1293,7 @@ maybe_make_artificial_property_decl (tree interface, tree implementation, else { getter = lookup_method (CLASS_NST_METHODS (implementation), getter_name); - setter = lookup_method (CLASS_NST_METHODS (implementation), setter_name); + setter = lookup_method (CLASS_NST_METHODS (implementation), setter_name); } } } @@ -1313,17 +1313,17 @@ maybe_make_artificial_property_decl (tree interface, tree implementation, /* Yes ... determine the type of the expression. */ tree property_decl; tree type; - + if (getter) type = TREE_VALUE (TREE_TYPE (getter)); else type = TREE_VALUE (TREE_TYPE (METHOD_SEL_ARGS (setter))); - + /* Create an artificial property declaration with the information we collected on the type and getter/setter names. */ property_decl = make_node (PROPERTY_DECL); - + TREE_TYPE (property_decl) = type; DECL_SOURCE_LOCATION (property_decl) = input_location; TREE_DEPRECATED (property_decl) = 0; @@ -1383,10 +1383,10 @@ objc_maybe_build_component_ref (tree object, tree property_ident) /* Try to determine if 'object' is an Objective-C object or not. If not, return. */ - if (object == NULL_TREE || object == error_mark_node + if (object == NULL_TREE || object == error_mark_node || (rtype = TREE_TYPE (object)) == NULL_TREE) return NULL_TREE; - + if (property_ident == NULL_TREE || property_ident == error_mark_node || TREE_CODE (property_ident) != IDENTIFIER_NODE) return NULL_TREE; @@ -1416,7 +1416,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) if (TYPE_HAS_OBJC_INFO (TREE_TYPE (rtype))) { tree rprotos = TYPE_OBJC_PROTOCOL_LIST (TREE_TYPE (rtype)); - + if (rprotos) { /* No point looking up declared @properties if we are @@ -1434,7 +1434,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) an artifical property based on them if found. */ x = maybe_make_artificial_property_decl (NULL_TREE, NULL_TREE, - rprotos, + rprotos, property_ident, IS_CLASS (rtype), NULL_TREE); @@ -1454,7 +1454,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) rprotos, property_ident, false, - PROPERTY_GETTER_NAME (x)); + PROPERTY_GETTER_NAME (x)); } } } @@ -1469,8 +1469,8 @@ objc_maybe_build_component_ref (tree object, tree property_ident) || CONVERT_EXPR_P (t) || TREE_CODE (t) == COMPONENT_REF) t = TREE_OPERAND (t, 0); - - if (t == UOBJC_SUPER_decl) + + if (t == UOBJC_SUPER_decl) interface_type = lookup_interface (CLASS_SUPER_NAME (implementation_template)); else if (t == self_decl) interface_type = lookup_interface (CLASS_NAME (implementation_template)); @@ -1479,7 +1479,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) { if (TREE_CODE (objc_method_context) != CLASS_METHOD_DECL) x = lookup_property (interface_type, property_ident); - + if (x == NULL_TREE) { /* Try the dot-syntax without a declared property. @@ -1492,8 +1492,8 @@ objc_maybe_build_component_ref (tree object, tree property_ident) if (t == self_decl) implementation = objc_implementation_context; - - x = maybe_make_artificial_property_decl + + x = maybe_make_artificial_property_decl (interface_type, implementation, NULL_TREE, property_ident, (TREE_CODE (objc_method_context) == CLASS_METHOD_DECL), @@ -1502,16 +1502,16 @@ objc_maybe_build_component_ref (tree object, tree property_ident) else if (PROPERTY_OPTIONAL (x) && PROPERTY_READONLY (x)) { tree implementation = NULL_TREE; - + if (t == self_decl) implementation = objc_implementation_context; - + x = maybe_make_artificial_property_decl (interface_type, implementation, NULL_TREE, property_ident, false, - PROPERTY_GETTER_NAME (x)); + PROPERTY_GETTER_NAME (x)); } } } @@ -1530,7 +1530,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) /* Traverse typedefs. */ while (basetype != NULL_TREE - && TREE_CODE (basetype) == RECORD_TYPE + && TREE_CODE (basetype) == RECORD_TYPE && OBJC_TYPE_NAME (basetype) && TREE_CODE (OBJC_TYPE_NAME (basetype)) == TYPE_DECL && DECL_ORIGINAL_TYPE (OBJC_TYPE_NAME (basetype))) @@ -1541,7 +1541,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) tree interface_type = TYPE_OBJC_INTERFACE (basetype); tree protocol_list = TYPE_OBJC_PROTOCOL_LIST (basetype); - if (interface_type + if (interface_type && (TREE_CODE (interface_type) == CLASS_INTERFACE_TYPE || TREE_CODE (interface_type) == CATEGORY_INTERFACE_TYPE || TREE_CODE (interface_type) == PROTOCOL_INTERFACE_TYPE)) @@ -1551,12 +1551,12 @@ objc_maybe_build_component_ref (tree object, tree property_ident) if (!IS_CLASS (rtype)) { x = lookup_property (interface_type, property_ident); - + if (x == NULL_TREE) - x = lookup_property_in_protocol_list (protocol_list, + x = lookup_property_in_protocol_list (protocol_list, property_ident); } - + if (x == NULL_TREE) { /* Try the dot-syntax without a declared property. @@ -1568,13 +1568,13 @@ objc_maybe_build_component_ref (tree object, tree property_ident) tree implementation = NULL_TREE; if (objc_implementation_context - && CLASS_NAME (objc_implementation_context) + && CLASS_NAME (objc_implementation_context) == OBJC_TYPE_NAME (interface_type)) implementation = objc_implementation_context; - + x = maybe_make_artificial_property_decl (interface_type, implementation, - protocol_list, + protocol_list, property_ident, IS_CLASS (rtype), NULL_TREE); @@ -1584,17 +1584,17 @@ objc_maybe_build_component_ref (tree object, tree property_ident) tree implementation = NULL_TREE; if (objc_implementation_context - && CLASS_NAME (objc_implementation_context) + && CLASS_NAME (objc_implementation_context) == OBJC_TYPE_NAME (interface_type)) implementation = objc_implementation_context; - + x = maybe_make_artificial_property_decl (interface_type, implementation, protocol_list, property_ident, false, - PROPERTY_GETTER_NAME (x)); - } + PROPERTY_GETTER_NAME (x)); + } } } } @@ -1643,7 +1643,7 @@ objc_maybe_build_component_ref (tree object, tree property_ident) deprecated_method_prototype); SET_EXPR_LOCATION (expression, input_location); TREE_SIDE_EFFECTS (expression) = 1; - + return expression; } @@ -1659,25 +1659,25 @@ objc_build_class_component_ref (tree class_name, tree property_ident) { tree x = NULL_TREE; tree object, rtype; - + if (flag_objc1_only) error_at (input_location, "the dot syntax is not available in Objective-C 1.0"); - + if (class_name == NULL_TREE || class_name == error_mark_node || TREE_CODE (class_name) != IDENTIFIER_NODE) return error_mark_node; - + if (property_ident == NULL_TREE || property_ident == error_mark_node || TREE_CODE (property_ident) != IDENTIFIER_NODE) return NULL_TREE; - + object = objc_get_class_reference (class_name); if (!object) { /* We know that 'class_name' is an Objective-C class name as the parser won't call this function if it is not. This is only a double-check for safety. */ - error_at (input_location, "could not find class %qE", class_name); + error_at (input_location, "could not find class %qE", class_name); return error_mark_node; } @@ -1685,19 +1685,19 @@ objc_build_class_component_ref (tree class_name, tree property_ident) if (!rtype) { /* Again, this should never happen, but we do check. */ - error_at (input_location, "could not find interface for class %qE", class_name); + error_at (input_location, "could not find interface for class %qE", class_name); return error_mark_node; } else { if (TREE_DEPRECATED (rtype)) - warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", class_name); + warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", class_name); } x = maybe_make_artificial_property_decl (rtype, NULL_TREE, NULL_TREE, property_ident, true, NULL_TREE); - + if (x) { tree expression; @@ -1720,8 +1720,8 @@ objc_build_class_component_ref (tree class_name, tree property_ident) } else { - error_at (input_location, "could not find setter/getter for %qE in class %qE", - property_ident, class_name); + error_at (input_location, "could not find setter/getter for %qE in class %qE", + property_ident, class_name); return error_mark_node; } @@ -1753,21 +1753,21 @@ objc_build_setter_call (tree lhs, tree rhs) { tree object_expr = PROPERTY_REF_OBJECT (lhs); tree property_decl = PROPERTY_REF_PROPERTY_DECL (lhs); - + if (PROPERTY_READONLY (property_decl)) { - error ("readonly property can not be set"); + error ("readonly property can not be set"); return error_mark_node; } else { tree setter_argument = build_tree_list (NULL_TREE, rhs); tree setter; - + /* TODO: Check that the setter return type is 'void'. */ /* TODO: Decay arguments in C. */ - setter = objc_finish_message_expr (object_expr, + setter = objc_finish_message_expr (object_expr, PROPERTY_SETTER_NAME (property_decl), setter_argument, NULL); return setter; @@ -1829,7 +1829,7 @@ objc_maybe_build_modify_expr (tree lhs, tree rhs) if (TREE_SIDE_EFFECTS (rhs)) { tree bind; - + /* Declare __objc_property_temp in a local bind. */ setter_argument = objc_create_temporary_var (TREE_TYPE (rhs), "__objc_property_temp"); DECL_SOURCE_LOCATION (setter_argument) = input_location; @@ -1850,19 +1850,19 @@ objc_maybe_build_modify_expr (tree lhs, tree rhs) setter_argument = rhs; s1 = NULL_TREE; } - + /* Now build the compound statement. */ - + /* s2: [object setProperty: x] */ s2 = objc_build_setter_call (lhs, setter_argument); - + /* This happens if building the setter failed because the property is readonly. */ if (s2 == error_mark_node) return error_mark_node; SET_EXPR_LOCATION (s2, input_location); - + /* s3: x */ s3 = convert (TREE_TYPE (lhs), setter_argument); @@ -1871,7 +1871,7 @@ objc_maybe_build_modify_expr (tree lhs, tree rhs) if (s1) compound_expr = build_compound_expr (input_location, build_compound_expr (input_location, s1, s2), s3); else - compound_expr = build_compound_expr (input_location, s2, s3); + compound_expr = build_compound_expr (input_location, s2, s3); /* Without this, with -Wall you get a 'valued computed is not used' every time there is a "object.property = x" where the @@ -1897,25 +1897,25 @@ objc_maybe_build_modify_expr (tree lhs, tree rhs) 'setter' for the property in an appropriate way to build the appropriate expression. 'code' is the code for the expression (one of the four mentioned above); 'argument' is the PROPERTY_REF, and - 'increment' is how much we need to add or subtract. */ + 'increment' is how much we need to add or subtract. */ tree objc_build_incr_expr_for_property_ref (location_t location, - enum tree_code code, + enum tree_code code, tree argument, tree increment) { /* Here are the expressions that we want to build: For PREINCREMENT_EXPR / PREDECREMENT_EXPR: (temp = [object property] +/- increment, [object setProperty: temp], temp) - + For POSTINCREMENT_EXPR / POSTECREMENT_EXPR: (temp = [object property], [object setProperty: temp +/- increment], temp) */ - + tree temp_variable_decl, bind; /* s1, s2 and s3 are the tree statements that we need in the compound expression. */ tree s1, s2, s3, compound_expr; - + /* Safety check. */ if (!argument || TREE_CODE (argument) != PROPERTY_REF) return error_mark_node; @@ -1927,28 +1927,28 @@ objc_build_incr_expr_for_property_ref (location_t location, SET_EXPR_LOCATION (bind, location); TREE_SIDE_EFFECTS (bind) = 1; add_stmt (bind); - + /* Now build the compound statement. */ - + /* Note that the 'getter' is generated at gimplify time; at this time, we can simply put the property_ref (ie, argument) wherever we want the getter ultimately to be. */ - + /* s1: __objc_property_temp = [object property] <+/- increment> */ switch (code) { - case PREINCREMENT_EXPR: + case PREINCREMENT_EXPR: /* __objc_property_temp = [object property] + increment */ s1 = build_modify_expr (location, temp_variable_decl, NULL_TREE, NOP_EXPR, - location, build2 (PLUS_EXPR, TREE_TYPE (argument), + location, build2 (PLUS_EXPR, TREE_TYPE (argument), argument, increment), NULL_TREE); break; case PREDECREMENT_EXPR: /* __objc_property_temp = [object property] - increment */ s1 = build_modify_expr (location, temp_variable_decl, NULL_TREE, NOP_EXPR, - location, build2 (MINUS_EXPR, TREE_TYPE (argument), + location, build2 (MINUS_EXPR, TREE_TYPE (argument), argument, increment), NULL_TREE); break; case POSTINCREMENT_EXPR: @@ -1961,11 +1961,11 @@ objc_build_incr_expr_for_property_ref (location_t location, default: gcc_unreachable (); } - + /* s2: [object setProperty: __objc_property_temp <+/- increment>] */ switch (code) { - case PREINCREMENT_EXPR: + case PREINCREMENT_EXPR: case PREDECREMENT_EXPR: /* [object setProperty: __objc_property_temp] */ s2 = objc_build_setter_call (argument, temp_variable_decl); @@ -1973,13 +1973,13 @@ objc_build_incr_expr_for_property_ref (location_t location, case POSTINCREMENT_EXPR: /* [object setProperty: __objc_property_temp + increment] */ s2 = objc_build_setter_call (argument, - build2 (PLUS_EXPR, TREE_TYPE (argument), + build2 (PLUS_EXPR, TREE_TYPE (argument), temp_variable_decl, increment)); break; case POSTDECREMENT_EXPR: /* [object setProperty: __objc_property_temp - increment] */ s2 = objc_build_setter_call (argument, - build2 (MINUS_EXPR, TREE_TYPE (argument), + build2 (MINUS_EXPR, TREE_TYPE (argument), temp_variable_decl, increment)); break; default: @@ -1991,11 +1991,11 @@ objc_build_incr_expr_for_property_ref (location_t location, if (s2 == error_mark_node) return error_mark_node; - SET_EXPR_LOCATION (s2, location); - + SET_EXPR_LOCATION (s2, location); + /* s3: __objc_property_temp */ s3 = convert (TREE_TYPE (argument), temp_variable_decl); - + /* Now build the compound statement (s1, s2, s3) */ compound_expr = build_compound_expr (location, build_compound_expr (location, s1, s2), s3); @@ -2391,8 +2391,8 @@ objc_common_type (tree type1, tree type2) -2 Initialization; -3 Comparison (LTYP and RTYP may match in either direction); -4 Silent comparison (for C++ overload resolution); - -5 Silent "specialization" comparison for RTYP to be a "specialization" - of LTYP (a specialization means that RTYP is LTYP plus some constraints, + -5 Silent "specialization" comparison for RTYP to be a "specialization" + of LTYP (a specialization means that RTYP is LTYP plus some constraints, so that each object of type RTYP is also of type LTYP). This is used when comparing property types. */ @@ -2496,7 +2496,7 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee) if (!lproto && objc_is_object_id (ltyp)) return true; } - + pointers_compatible = (TYPE_MAIN_VARIANT (ltyp) == TYPE_MAIN_VARIANT (rtyp)); /* If the underlying types are the same, and at most one of them has @@ -2521,7 +2521,7 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee) pointers_compatible = (objc_is_object_id (ltyp) || objc_is_object_id (rtyp)); else - pointers_compatible = objc_is_object_id (ltyp); + pointers_compatible = objc_is_object_id (ltyp); } if (!pointers_compatible) @@ -2588,7 +2588,7 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee) variety and calls objc_common_type to obtain a common type. There is no commonolty between two function-pointers in this regard. */ -bool +bool objc_have_common_type (tree ltyp, tree rtyp, int argno, tree callee) { if (objc_compare_types (ltyp, rtyp, argno, callee)) @@ -2785,7 +2785,7 @@ objc_get_protocol_qualified_type (tree interface, tree protocols) TREE_TYPE (type) = build_variant_type_copy (orig_pointee_type); /* Set up the canonical type information. */ - TYPE_CANONICAL (type) + TYPE_CANONICAL (type) = TYPE_CANONICAL (TYPE_POINTER_TO (orig_pointee_type)); TYPE_POINTER_TO (TREE_TYPE (type)) = type; @@ -2993,12 +2993,12 @@ synth_module_prologue (void) /* Declare struct _objc_fast_enumeration_state { ... }; */ build_fast_enumeration_state_template (); - + /* void objc_enumeration_mutation (id) */ type = build_function_type_list (void_type_node, objc_object_type, NULL_TREE); - objc_enumeration_mutation_decl - = add_builtin_function (TAG_ENUMERATION_MUTATION, type, 0, NOT_BUILT_IN, + objc_enumeration_mutation_decl + = add_builtin_function (TAG_ENUMERATION_MUTATION, type, 0, NOT_BUILT_IN, NULL, NULL_TREE); TREE_NOTHROW (objc_enumeration_mutation_decl) = 0; @@ -3140,11 +3140,11 @@ objc_build_string_object (tree string) TREE_SET_CODE (string, STRING_CST); length = TREE_STRING_LENGTH (string) - 1; - /* The target may have different ideas on how to construct an ObjC string - literal. On Darwin (Mac OS X), for example, we may wish to obtain a + /* The target may have different ideas on how to construct an ObjC string + literal. On Darwin (Mac OS X), for example, we may wish to obtain a constant CFString reference instead. At present, this is only supported for the NeXT runtime. */ - if (flag_next_runtime + if (flag_next_runtime && targetcm.objc_construct_string_object) { tree constructor = (*targetcm.objc_construct_string_object) (string); @@ -3192,7 +3192,7 @@ objc_build_string_object (tree string) { *loc = desc = ggc_alloc_string_descriptor (); desc->literal = string; - desc->constructor = + desc->constructor = (*runtime.build_const_string_constructor) (input_location, string, length); } @@ -3354,7 +3354,7 @@ objc_declare_alias (tree alias_ident, tree class_ident) #ifdef OBJCPLUS pop_lang_context (); #endif - hash_class_name_enter (als_name_hash_list, alias_ident, + hash_class_name_enter (als_name_hash_list, alias_ident, underlying_class); } } @@ -3371,14 +3371,14 @@ objc_declare_class (tree identifier) if (! objc_is_class_name (identifier)) { tree record = lookup_name (identifier), type = record; - + if (record) { if (TREE_CODE (record) == TYPE_DECL) type = DECL_ORIGINAL_TYPE (record) ? DECL_ORIGINAL_TYPE (record) : TREE_TYPE (record); - + if (!TYPE_HAS_OBJC_INFO (type) || !TYPE_OBJC_INTERFACE (type)) { @@ -3388,7 +3388,7 @@ objc_declare_class (tree identifier) record); } } - + record = xref_tag (RECORD_TYPE, identifier); INIT_TYPE_OBJC_INFO (record); /* In the case of a @class declaration, we store the ident in @@ -3577,7 +3577,7 @@ objc_build_global_assignment (tree lhs, tree rhs) NULL_TREE)); assemble_external (objc_assign_global_decl); - return build_function_call (input_location, + return build_function_call (input_location, objc_assign_global_decl, func_params); } @@ -3867,18 +3867,18 @@ eq_instance_variable (const PTR p1, const PTR p2) bool objc_detect_field_duplicates (bool check_superclasses_only) { - if (!objc_collecting_ivars || !objc_interface_context + if (!objc_collecting_ivars || !objc_interface_context || TREE_CODE (objc_interface_context) != CLASS_INTERFACE_TYPE) return false; /* We have two ways of doing this check: - + "direct comparison": we iterate over the instance variables and compare them directly. This works great for small numbers of instance variables (such as 10 or 20), which are extremely common. But it will potentially take forever for the pathological case with a huge number (eg, 10k) of instance variables. - + "hashtable": we use a hashtable, which requires a single sweep through the list of instances variables. This is much slower for a small number of variables, and we only use it for large numbers. @@ -3901,7 +3901,7 @@ objc_detect_field_duplicates (bool check_superclasses_only) /* Exit if there is nothing to do. */ if (number_of_ivars_to_check == 0) return true; - + /* In case that there are only 1 or 2 instance variables to check, we always use direct comparison. If there are more, it is worth iterating over the instance variables in the superclass @@ -3926,7 +3926,7 @@ objc_detect_field_duplicates (bool check_superclasses_only) } /* We use a hashtable if we have over 10k comparisons. */ - if (number_of_ivars_to_check * (number_of_superclass_ivars + if (number_of_ivars_to_check * (number_of_superclass_ivars + (number_of_ivars_to_check / 2)) > 10000) { @@ -3954,7 +3954,7 @@ objc_detect_field_duplicates (bool check_superclasses_only) } } } - + /* Now, we go through all the instance variables in the class, and check that they are not in the hashtable. */ @@ -4015,7 +4015,7 @@ objc_detect_field_duplicates (bool check_superclasses_only) } } } - + /* This is the "direct comparison" approach, which is used in most non-pathological cases. */ { @@ -4026,7 +4026,7 @@ objc_detect_field_duplicates (bool check_superclasses_only) if (check_superclasses_only) interface = lookup_interface (CLASS_SUPER_NAME (interface)); - + for ( ; interface; interface = lookup_interface (CLASS_SUPER_NAME (interface))) { @@ -4037,7 +4037,7 @@ objc_detect_field_duplicates (bool check_superclasses_only) ivar_being_checked = DECL_CHAIN (ivar_being_checked)) { tree decl; - + /* Ignore anonymous ivars. */ if (DECL_NAME (ivar_being_checked) == NULL_TREE) continue; @@ -4205,7 +4205,7 @@ objc_begin_catch_clause (tree decl) && TYPE_OBJC_PROTOCOL_LIST (TREE_TYPE (type))) { error ("@catch parameter can not be protocol-qualified"); - type = error_mark_node; + type = error_mark_node; } else if (POINTER_TYPE_P (type) && objc_is_object_id (TREE_TYPE (type))) /* @catch (id xyz) or @catch (...) but we note this for runtimes that @@ -4217,11 +4217,11 @@ objc_begin_catch_clause (tree decl) them and get a simple pointer to the class. */ bool is_typedef = false; tree x = TYPE_MAIN_VARIANT (type); - + /* Skip from the pointer to the pointee. */ if (TREE_CODE (x) == POINTER_TYPE) x = TREE_TYPE (x); - + /* Traverse typedef aliases */ while (TREE_CODE (x) == RECORD_TYPE && OBJC_TYPE_NAME (x) && TREE_CODE (OBJC_TYPE_NAME (x)) == TYPE_DECL @@ -4364,7 +4364,7 @@ objc_build_synchronized (location_t start_locus, tree object_expr, tree body) object_expr = error_mark_node; } } - + if (object_expr == error_mark_node) { /* If we found an error, we simply ignore the '@synchronized'. @@ -4377,7 +4377,7 @@ objc_build_synchronized (location_t start_locus, tree object_expr, tree body) tree call; tree args; - /* objc_sync_enter (object_expr); */ + /* objc_sync_enter (object_expr); */ object_expr = save_expr (object_expr); args = tree_cons (NULL, object_expr, NULL); call = build_function_call (input_location, @@ -4394,10 +4394,10 @@ objc_build_synchronized (location_t start_locus, tree object_expr, tree body) /* @try { body; } */ objc_begin_try_stmt (start_locus, body); - + /* @finally { objc_sync_exit (object_expr); } */ objc_build_finally_clause (input_location, call); - + /* End of try statement. */ return objc_finish_try_stmt (); } @@ -4789,7 +4789,7 @@ adjust_type_for_id_default (tree type) For example, take the Objective-C method - -(NSString *)pathForResource:(NSString *)resource ofType:(NSString *)type; + -(NSString *)pathForResource:(NSString *)resource ofType:(NSString *)type; the two fragments "pathForResource:(NSString *)resource" and "ofType:(NSString *)type" will generate a KEYWORD_DECL each. The @@ -4809,7 +4809,7 @@ adjust_type_for_id_default (tree type) 'arg_name' is an identifier node and is required. 'attributes' is an optional tree containing parameter attributes. */ tree -objc_build_keyword_decl (tree key_name, tree arg_type, +objc_build_keyword_decl (tree key_name, tree arg_type, tree arg_name, tree attributes) { tree keyword_decl; @@ -4951,14 +4951,14 @@ objc_decl_method_attributes (tree *node, tree attributes, int flags) for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute)) { tree name = TREE_PURPOSE (attribute); - + if (is_attribute_p ("deprecated", name) || is_attribute_p ("sentinel", name) || is_attribute_p ("noreturn", name)) { /* An attribute that we support; add it to the filtered attributes. */ - filtered_attributes = chainon (filtered_attributes, + filtered_attributes = chainon (filtered_attributes, copy_node (attribute)); } else if (is_attribute_p ("format", name)) @@ -4998,11 +4998,11 @@ objc_decl_method_attributes (tree *node, tree attributes, int flags) && TREE_CODE (number) == INTEGER_CST && TREE_INT_CST_HIGH (number) == 0) { - TREE_VALUE (second_argument) + TREE_VALUE (second_argument) = build_int_cst (integer_type_node, TREE_INT_CST_LOW (number) + 2); } - + /* This is the third argument, the "first-to-check", which specifies the index of the first argument to check. This could be 0, meaning it is not available, @@ -5014,7 +5014,7 @@ objc_decl_method_attributes (tree *node, tree attributes, int flags) && TREE_INT_CST_HIGH (number) == 0 && TREE_INT_CST_LOW (number) != 0) { - TREE_VALUE (third_argument) + TREE_VALUE (third_argument) = build_int_cst (integer_type_node, TREE_INT_CST_LOW (number) + 2); } @@ -5040,7 +5040,7 @@ objc_decl_method_attributes (tree *node, tree attributes, int flags) (by setting TREE_DEPRECATED and TREE_THIS_VOLATILE) so there is nothing to do. */ tree saved_type = TREE_TYPE (*node); - TREE_TYPE (*node) = build_function_type + TREE_TYPE (*node) = build_function_type (TREE_VALUE (saved_type), get_arg_type_list (*node, METHOD_REF, 0)); decl_attributes (node, filtered_attributes, flags); METHOD_TYPE_ATTRIBUTES (*node) = TYPE_ATTRIBUTES (TREE_TYPE (*node)); @@ -5048,7 +5048,7 @@ objc_decl_method_attributes (tree *node, tree attributes, int flags) } } -bool +bool objc_method_decl (enum tree_code opcode) { return opcode == INSTANCE_METHOD_DECL || opcode == CLASS_METHOD_DECL; @@ -5461,7 +5461,7 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, if (!rtype || TREE_CODE (rtype) == IDENTIFIER_NODE) { rtype = NULL_TREE; - /* We could not find an @interface declaration, yet Message maybe in a + /* We could not find an @interface declaration, yet Message maybe in a @class's protocol. */ if (!method_prototype && rprotos) method_prototype @@ -5521,7 +5521,7 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, = lookup_method_in_hash_lists (sel_name, class_tree != NULL_TREE); } - if (!method_prototype) + if (!method_prototype) { static bool warn_missing_methods = false; @@ -5540,11 +5540,11 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, if (!warn_missing_methods) { - warning_at (input_location, + warning_at (input_location, 0, "(Messages without a matching method signature"); - warning_at (input_location, + warning_at (input_location, 0, "will be assumed to return % and accept"); - warning_at (input_location, + warning_at (input_location, 0, "%<...%> as arguments.)"); warn_missing_methods = true; } @@ -5578,9 +5578,9 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, current_objc_message_selector = sel_name; /* Build the method call. - TODO: Get the location from somewhere that will work for delayed + TODO: Get the location from somewhere that will work for delayed expansion. */ - + retval = (*runtime.build_objc_method_call) (input_location, method_prototype, receiver, rtype, sel_name, method_params, super); @@ -5591,7 +5591,7 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params, } -/* This routine creates a static variable used to implement @protocol(MyProtocol) +/* This routine creates a static variable used to implement @protocol(MyProtocol) expression. This variable will be initialized to global protocol_t meta-data pointer. */ @@ -5930,7 +5930,7 @@ lookup_method_static (tree interface, tree ident, int flags) } else { - /* If an instance method was not found, return 0. */ + /* If an instance method was not found, return 0. */ return NULL_TREE; } } @@ -6004,7 +6004,7 @@ objc_add_method (tree klass, tree method, int is_class, bool is_optional) existing_method = lookup_method (PROTOCOL_OPTIONAL_CLS_METHODS (klass), method); else existing_method = lookup_method (PROTOCOL_OPTIONAL_NST_METHODS (klass), method); - + if (!is_optional && existing_method) { error ("method %<%c%E%> declared %<@optional%> and %<@required%> at the same time", @@ -6217,7 +6217,7 @@ printable_ivar_name (tree field_decl) VISIBILITY is 1 for public, 0 for protected, and 2 for private. */ static tree -add_instance_variable (tree klass, objc_ivar_visibility_kind visibility, +add_instance_variable (tree klass, objc_ivar_visibility_kind visibility, tree field_decl) { tree field_type = TREE_TYPE (field_decl); @@ -6260,7 +6260,7 @@ add_instance_variable (tree klass, objc_ivar_visibility_kind visibility, error ("instance variable %qs uses flexible array member", printable_ivar_name (field_decl)); /* Return class as is without adding this ivar. */ - return klass; + return klass; } #endif @@ -6385,9 +6385,9 @@ ivar_of_class (tree klass, tree ivar_name_ident) while (CLASS_SUPER_NAME (klass)) { klass = lookup_interface (CLASS_SUPER_NAME (klass)); - + decl_chain = CLASS_RAW_IVARS (klass); - + for ( ; decl_chain; decl_chain = DECL_CHAIN (decl_chain)) if (DECL_NAME (decl_chain) == ivar_name_ident) return decl_chain; @@ -6515,7 +6515,7 @@ check_methods (tree chain, tree implementation, int mtype) && (PROPERTY_GETTER_NAME (x) == METHOD_SEL_NAME (chain) || PROPERTY_SETTER_NAME (x) == METHOD_SEL_NAME (chain))) break; - + if (x != NULL_TREE) { chain = TREE_CHAIN (chain); /* next method... */ @@ -6544,7 +6544,7 @@ check_methods (tree chain, tree implementation, int mtype) if (lookup_method (CLASS_NST_METHODS (interface), chain)) { chain = DECL_CHAIN (chain); - continue; + continue; } /* Else, get the superclass. */ @@ -6650,12 +6650,12 @@ check_methods_accessible (tree chain, tree context, int mtype) && (PROPERTY_GETTER_NAME (x) == METHOD_SEL_NAME (chain) || PROPERTY_SETTER_NAME (x) == METHOD_SEL_NAME (chain))) break; - + if (x != NULL_TREE) { chain = TREE_CHAIN (chain); /* next method... */ continue; - } + } context = base_context; while (context) @@ -6834,7 +6834,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, if (super) super_interface = lookup_interface (super); - + if (!super_interface) { error ("cannot find interface declaration for %qE, superclass of %qE", @@ -6845,7 +6845,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, else { if (TREE_DEPRECATED (super_interface)) - warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", + warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", super); super_name = super; } @@ -6872,7 +6872,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, case CLASS_IMPLEMENTATION_TYPE: { tree chain; - + for (chain = implemented_classes; chain; chain = TREE_CHAIN (chain)) if (TREE_VALUE (chain) == class_name) { @@ -6933,7 +6933,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, #endif else add_class (klass, class_name); - + if (protocol_list) CLASS_PROTOCOL_LIST (klass) = lookup_and_install_protocols (protocol_list, /* definition_required */ true); @@ -6944,7 +6944,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute)) { tree name = TREE_PURPOSE (attribute); - + /* TODO: Document what the objc_exception attribute is/does. */ /* We handle the 'deprecated' and (undocumented) 'objc_exception' attributes. */ @@ -6958,12 +6958,12 @@ start_class (enum tree_code code, tree class_name, tree super_name, } TYPE_ATTRIBUTES (klass) = attributes; } - break; + break; case CATEGORY_INTERFACE_TYPE: { tree class_category_is_assoc_with; - + /* For a category, class_name is really the name of the class that the following set of methods will be associated with. We must find the interface so that can derive the objects template. */ @@ -6976,7 +6976,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, else { if (TREE_DEPRECATED (class_category_is_assoc_with)) - warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", + warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", class_name); if (super_name == NULL_TREE) @@ -7000,7 +7000,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, else { add_category (class_category_is_assoc_with, klass); - + if (protocol_list) CLASS_PROTOCOL_LIST (klass) = lookup_and_install_protocols @@ -7009,7 +7009,7 @@ start_class (enum tree_code code, tree class_name, tree super_name, } } break; - + case CATEGORY_IMPLEMENTATION_TYPE: /* Reset for multiple classes per file. */ method_slot = 0; @@ -7047,7 +7047,7 @@ continue_class (tree klass) if (CLASS_RAW_IVARS (klass)) check_ivars (implementation_template, klass); - + /* code generation */ #ifdef OBJCPLUS push_lang_context (lang_name_c); @@ -7083,7 +7083,7 @@ continue_class (tree klass) #ifdef OBJCPLUS pop_lang_context (); #endif /* OBJCPLUS */ - + return get_class_ivars (implementation_template, true); break; } @@ -7121,18 +7121,18 @@ objc_build_property_setter_name (tree ident) /* This routine prepares the declarations of the property accessor helper functions (objc_getProperty(), etc) that are used when - @synthesize is used. - - runtime-specific routines are built in the respective runtime + @synthesize is used. + + runtime-specific routines are built in the respective runtime initialize functions. */ -static void +static void build_common_objc_property_accessor_helpers (void) { tree type; /* Declare the following function: id - objc_getProperty (id self, SEL _cmd, + objc_getProperty (id self, SEL _cmd, ptrdiff_t offset, BOOL is_atomic); */ type = build_function_type_list (objc_object_type, objc_object_type, @@ -7144,11 +7144,11 @@ build_common_objc_property_accessor_helpers (void) type, 0, NOT_BUILT_IN, NULL, NULL_TREE); TREE_NOTHROW (objc_getProperty_decl) = 0; - + /* Declare the following function: void - objc_setProperty (id self, SEL _cmd, - ptrdiff_t offset, id new_value, + objc_setProperty (id self, SEL _cmd, + ptrdiff_t offset, id new_value, BOOL is_atomic, BOOL should_copy); */ type = build_function_type_list (void_type_node, objc_object_type, @@ -7171,16 +7171,16 @@ lookup_ivar (tree interface, tree instance_variable_name) while (interface) { tree decl_chain; - + for (decl_chain = CLASS_IVARS (interface); decl_chain; decl_chain = DECL_CHAIN (decl_chain)) if (DECL_NAME (decl_chain) == instance_variable_name) return decl_chain; - + /* Not found. Search superclass if any. */ if (CLASS_SUPER_NAME (interface)) interface = lookup_interface (CLASS_SUPER_NAME (interface)); } - + return NULL_TREE; } @@ -7273,7 +7273,7 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr (NULL_TREE, is_atomic, NULL_TREE))))); } break; - case OBJC_PROPERTY_ASSIGN: + case OBJC_PROPERTY_ASSIGN: if (PROPERTY_NONATOMIC (property)) { /* We build "return self->PROPERTY_IVAR_NAME;" */ @@ -7305,12 +7305,12 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property), true /* is_sizeof */, false /* complain */); - + if (PROPERTY_NONATOMIC (property)) is_atomic = boolean_false_node; else is_atomic = boolean_true_node; - + if (objc_copyStruct_decl) function_decl = objc_copyStruct_decl; else @@ -7326,8 +7326,8 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr here causes invalid code to be generated. */ (NULL_TREE, build_unary_op (location, ADDR_EXPR, objc_property_temp_decl, 0), tree_cons /* &(self->PROPERTY_IVAR_NAME); */ - (NULL_TREE, build_fold_addr_expr_loc (location, - objc_lookup_ivar + (NULL_TREE, build_fold_addr_expr_loc (location, + objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property))), tree_cons /* sizeof (PROPERTY_IVAR) */ (NULL_TREE, size_of, @@ -7451,7 +7451,7 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr is_atomic = boolean_false_node; else is_atomic = boolean_true_node; - + if (PROPERTY_ASSIGN_SEMANTICS (property) == OBJC_PROPERTY_COPY) should_copy = boolean_true_node; else @@ -7471,19 +7471,19 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr tree_cons /* new_value */ (NULL_TREE, new_value, tree_cons /* is_atomic */ - (NULL_TREE, is_atomic, + (NULL_TREE, is_atomic, tree_cons /* should_copy */ (NULL_TREE, should_copy, NULL_TREE))))))); } break; - case OBJC_PROPERTY_ASSIGN: + case OBJC_PROPERTY_ASSIGN: if (PROPERTY_NONATOMIC (property)) { /* We build "self->PROPERTY_IVAR_NAME = new_value;" */ statement = build_modify_expr (location, objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property)), - NULL_TREE, NOP_EXPR, + NULL_TREE, NOP_EXPR, location, new_value, NULL_TREE); break; } @@ -7505,25 +7505,25 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property), true /* is_sizeof */, false /* complain */); - + if (PROPERTY_NONATOMIC (property)) is_atomic = boolean_false_node; else is_atomic = boolean_true_node; - + if (objc_copyStruct_decl) function_decl = objc_copyStruct_decl; else function_decl = objc_setPropertyStruct_decl; - statement = build_function_call + statement = build_function_call (location, /* Function prototype. */ function_decl, /* Parameters. */ tree_cons /* &(self->PROPERTY_IVAR_NAME); */ - (NULL_TREE, build_fold_addr_expr_loc (location, - objc_lookup_ivar + (NULL_TREE, build_fold_addr_expr_loc (location, + objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property))), tree_cons /* &new_value */ (NULL_TREE, build_fold_addr_expr_loc (location, new_value), @@ -7542,7 +7542,7 @@ objc_synthesize_setter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr } gcc_assert (statement); - add_stmt (statement); + add_stmt (statement); add_stmt (c_end_compound_stmt (location, body, true)); fn = current_function_decl; #ifdef OBJCPLUS @@ -7568,14 +7568,14 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac if (PROPERTY_NAME (property) == property_name) { location_t original_location = DECL_SOURCE_LOCATION (property); - + if (PROPERTY_DYNAMIC (property)) - error_at (location, "property %qs already specified in %<@dynamic%>", + error_at (location, "property %qs already specified in %<@dynamic%>", IDENTIFIER_POINTER (property_name)); else - error_at (location, "property %qs already specified in %<@synthesize%>", + error_at (location, "property %qs already specified in %<@synthesize%>", IDENTIFIER_POINTER (property_name)); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -7587,7 +7587,7 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac if (!property) { - error_at (location, "no declaration of property %qs found in the interface", + error_at (location, "no declaration of property %qs found in the interface", IDENTIFIER_POINTER (property_name)); return; } @@ -7614,7 +7614,7 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac tree type_of_ivar; if (!ivar) { - error_at (location, "ivar %qs used by %<@synthesize%> declaration must be an existing ivar", + error_at (location, "ivar %qs used by %<@synthesize%> declaration must be an existing ivar", IDENTIFIER_POINTER (property_name)); return; } @@ -7623,7 +7623,7 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac type_of_ivar = DECL_BIT_FIELD_TYPE (ivar); else type_of_ivar = TREE_TYPE (ivar); - + /* If the instance variable has a different C type, we throw an error ... */ if (!comptypes (TREE_TYPE (property), type_of_ivar) /* ... unless the property is readonly, in which case we allow @@ -7634,11 +7634,11 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac type_of_ivar, -5, NULL_TREE))) { location_t original_location = DECL_SOURCE_LOCATION (ivar); - + error_at (location, "property %qs is using instance variable %qs of incompatible type", IDENTIFIER_POINTER (property_name), IDENTIFIER_POINTER (ivar_name)); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); } @@ -7656,11 +7656,11 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac if (PROPERTY_ASSIGN_SEMANTICS (property) != OBJC_PROPERTY_ASSIGN) { location_t original_location = DECL_SOURCE_LOCATION (ivar); - + error_at (location, "'assign' property %qs is using bit-field instance variable %qs", IDENTIFIER_POINTER (property_name), IDENTIFIER_POINTER (ivar_name)); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -7669,11 +7669,11 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac if (!PROPERTY_NONATOMIC (property)) { location_t original_location = DECL_SOURCE_LOCATION (ivar); - + error_at (location, "'atomic' property %qs is using bit-field instance variable %qs", IDENTIFIER_POINTER (property_name), IDENTIFIER_POINTER (ivar_name)); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); return; @@ -7687,14 +7687,14 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac if (PROPERTY_IVAR_NAME (x) == ivar_name) { location_t original_location = DECL_SOURCE_LOCATION (x); - + error_at (location, "property %qs is using the same instance variable as property %qs", IDENTIFIER_POINTER (property_name), IDENTIFIER_POINTER (PROPERTY_NAME (x))); - + if (original_location != UNKNOWN_LOCATION) inform (original_location, "originally specified here"); - + /* We keep going on. This won't cause the compiler to fail; the failure would most likely be at runtime. */ } @@ -7703,7 +7703,7 @@ objc_add_synthesize_declaration_for_property (location_t location, tree interfac PROPERTY_IVAR_NAME to a non-NULL_TREE. You can recognize a @synthesize by that. */ PROPERTY_IVAR_NAME (property) = ivar_name; - + /* PROPERTY_SETTER_NAME and PROPERTY_GETTER_NAME are copied from the original declaration; they are always set (with the exception of PROPERTY_SETTER_NAME not being set if PROPERTY_READONLY == 1). */ @@ -7754,7 +7754,7 @@ objc_add_synthesize_declaration (location_t location, tree property_and_ivar_lis if (!interface) { /* I can't see how this could happen, but it is good as a safety check. */ - error_at (location, + error_at (location, "%<@synthesize%> requires the @interface of the class to be available"); return; } @@ -7762,7 +7762,7 @@ objc_add_synthesize_declaration (location_t location, tree property_and_ivar_lis /* Now, iterate over the properties and do each of them. */ for (chain = property_and_ivar_list; chain; chain = TREE_CHAIN (chain)) { - objc_add_synthesize_declaration_for_property (location, interface, TREE_VALUE (chain), + objc_add_synthesize_declaration_for_property (location, interface, TREE_VALUE (chain), TREE_PURPOSE (chain)); } } @@ -7783,9 +7783,9 @@ objc_add_dynamic_declaration_for_property (location_t location, tree interface, if (PROPERTY_NAME (property) == property_name) { location_t original_location = DECL_SOURCE_LOCATION (property); - + if (PROPERTY_DYNAMIC (property)) - error_at (location, "property %qs already specified in %<@dynamic%>", + error_at (location, "property %qs already specified in %<@dynamic%>", IDENTIFIER_POINTER (property_name)); else error_at (location, "property %qs already specified in %<@synthesize%>", @@ -7860,7 +7860,7 @@ objc_add_dynamic_declaration (location_t location, tree property_list) interface = lookup_interface (CLASS_NAME (objc_implementation_context)); break; case CATEGORY_IMPLEMENTATION_TYPE: - interface = lookup_category (implementation_template, + interface = lookup_category (implementation_template, CLASS_SUPER_NAME (objc_implementation_context)); break; default: @@ -7882,7 +7882,7 @@ objc_add_dynamic_declaration (location_t location, tree property_list) } } -/* Main routine to generate code/data for all the property information for +/* Main routine to generate code/data for all the property information for current implementation (class or category). CLASS is the interface where ivars are declared. CLASS_METHODS is where methods are found which could be a class or a category depending on whether we are implementing @@ -7898,12 +7898,12 @@ objc_gen_property_data (tree klass, tree class_methods) /* @dynamic property - nothing to check or synthesize. */ if (PROPERTY_DYNAMIC (x)) continue; - + /* @synthesize property - need to synthesize the accessors. */ if (PROPERTY_IVAR_NAME (x)) { objc_synthesize_getter (klass, class_methods, x); - + if (PROPERTY_READONLY (x) == 0) objc_synthesize_setter (klass, class_methods, x); @@ -7924,7 +7924,7 @@ finish_class (tree klass) case CLASS_IMPLEMENTATION_TYPE: { /* All metadata generation is done in runtime.generate_metadata(). */ - + /* Generate what needed for property; setters, getters, etc. */ objc_gen_property_data (implementation_template, implementation_template); @@ -7946,7 +7946,7 @@ finish_class (tree klass) case CATEGORY_IMPLEMENTATION_TYPE: { tree category = lookup_category (implementation_template, CLASS_SUPER_NAME (klass)); - + if (category) { /* Generate what needed for property; setters, getters, etc. */ @@ -7957,7 +7957,7 @@ finish_class (tree klass) objc_implementation_context, '+'); check_methods (CLASS_NST_METHODS (category), objc_implementation_context, '-'); - + if (CLASS_PROTOCOL_LIST (category)) check_protocols (CLASS_PROTOCOL_LIST (category), "category", @@ -7977,7 +7977,7 @@ finish_class (tree klass) and if not, we declare one ourselves. */ tree getter_decl = lookup_method (CLASS_NST_METHODS (klass), PROPERTY_GETTER_NAME (x)); - + if (getter_decl) { /* TODO: Check that the declaration is consistent with the property. */ @@ -7990,8 +7990,8 @@ finish_class (tree klass) will be of the form -(type)property_getter_name; */ tree rettype = build_tree_list (NULL_TREE, TREE_TYPE (x)); - getter_decl = build_method_decl (INSTANCE_METHOD_DECL, - rettype, PROPERTY_GETTER_NAME (x), + getter_decl = build_method_decl (INSTANCE_METHOD_DECL, + rettype, PROPERTY_GETTER_NAME (x), NULL_TREE, false); if (PROPERTY_OPTIONAL (x)) objc_add_method (objc_interface_context, getter_decl, false, true); @@ -8005,9 +8005,9 @@ finish_class (tree klass) { /* Now we check that the appropriate setter is declared, and if not, we declare on ourselves. */ - tree setter_decl = lookup_method (CLASS_NST_METHODS (klass), + tree setter_decl = lookup_method (CLASS_NST_METHODS (klass), PROPERTY_SETTER_NAME (x)); - + if (setter_decl) { /* TODO: Check that the declaration is consistent with the property. */ @@ -8025,7 +8025,7 @@ finish_class (tree klass) size_t length = strlen (full_setter_name); char *setter_name = (char *) alloca (length); tree ret_type, selector, arg_type, arg_name; - + strcpy (setter_name, full_setter_name); setter_name[length - 1] = '\0'; ret_type = build_tree_list (NULL_TREE, void_type_node); @@ -8033,7 +8033,7 @@ finish_class (tree klass) arg_name = get_identifier ("_value"); selector = objc_build_keyword_decl (get_identifier (setter_name), arg_type, arg_name, NULL); - setter_decl = build_method_decl (INSTANCE_METHOD_DECL, + setter_decl = build_method_decl (INSTANCE_METHOD_DECL, ret_type, selector, build_tree_list (NULL_TREE, NULL_TREE), false); @@ -8043,7 +8043,7 @@ finish_class (tree klass) objc_add_method (objc_interface_context, setter_decl, false, false); TREE_DEPRECATED (setter_decl) = TREE_DEPRECATED (x); METHOD_PROPERTY_CONTEXT (setter_decl) = x; - } + } } } break; @@ -8100,7 +8100,7 @@ lookup_protocol (tree ident, bool warn_if_deprecated, bool definition_required) /* It would be nice to use warn_deprecated_use() here, but we are using TREE_CHAIN (which is supposed to be the TYPE_STUB_DECL for a TYPE) for something different. */ - warning (OPT_Wdeprecated_declarations, "protocol %qE is deprecated", + warning (OPT_Wdeprecated_declarations, "protocol %qE is deprecated", PROTOCOL_NAME (chain)); } @@ -8135,7 +8135,7 @@ objc_declare_protocol (tree name, tree attributes) for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute)) { tree name = TREE_PURPOSE (attribute); - + if (is_attribute_p ("deprecated", name)) deprecated = true; else @@ -8147,7 +8147,7 @@ objc_declare_protocol (tree name, tree attributes) /* definition_required */ false) == NULL_TREE) { tree protocol = make_node (PROTOCOL_INTERFACE_TYPE); - + TYPE_LANG_SLOT_1 (protocol) = make_tree_vec (PROTOCOL_LANG_SLOT_ELTS); PROTOCOL_NAME (protocol) = name; @@ -8155,7 +8155,7 @@ objc_declare_protocol (tree name, tree attributes) add_protocol (protocol); PROTOCOL_DEFINED (protocol) = 0; PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE; - + if (attributes) { /* TODO: Do we need to store the attributes here ? */ @@ -8186,7 +8186,7 @@ start_protocol (enum tree_code code, tree name, tree list, tree attributes) for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute)) { tree name = TREE_PURPOSE (attribute); - + if (is_attribute_p ("deprecated", name)) deprecated = true; else @@ -8438,7 +8438,7 @@ objc_types_are_equivalent (tree type1, tree type2) identical. */ if (type1 == NULL_TREE && type2 == NULL_TREE) return 1; - + /* If one has protocols, and the other one hasn't, they are not identical. */ if ((type1 == NULL_TREE && type2 != NULL_TREE) @@ -8455,11 +8455,11 @@ objc_types_are_equivalent (tree type1, tree type2) for (t = type2; t; t = TREE_CHAIN (t)) if (!lookup_protocol_in_reflist (type1, TREE_VALUE (t))) return 0; - + for (t = type1; t; t = TREE_CHAIN (t)) if (!lookup_protocol_in_reflist (type2, TREE_VALUE (t))) return 0; - + return 1; } } @@ -8516,16 +8516,16 @@ comp_proto_with_proto (tree proto1, tree proto2, int strict) { type1 = TREE_VALUE (TREE_TYPE (arg1)); type2 = TREE_VALUE (TREE_TYPE (arg2)); - + /* FIXME: Do we need to decay argument types to compare them ? */ type1 = objc_decay_parm_type (type1); type2 = objc_decay_parm_type (type2); - + if (!objc_types_are_equivalent (type1, type2) && (strict || !objc_types_share_size_and_alignment (type1, type2))) return 0; } - + /* The loop ends when arg1 or arg2 are NULL. Make sure they are both NULL. */ if (arg1 != arg2) @@ -8544,17 +8544,17 @@ comp_proto_with_proto (tree proto1, tree proto2, int strict) { type1 = TREE_TYPE (TREE_VALUE (arg1)); type2 = TREE_TYPE (TREE_VALUE (arg2)); - + /* FIXME: Do we need to decay argument types to compare them ? */ type1 = objc_decay_parm_type (type1); type2 = objc_decay_parm_type (type2); - + if (!objc_types_are_equivalent (type1, type2) && (strict || !objc_types_share_size_and_alignment (type1, type2))) return 0; } } - + /* The loop ends when arg1 or arg2 are NULL. Make sure they are both NULL. */ if (arg1 != arg2) @@ -8768,7 +8768,7 @@ really_start_method (tree method, if (interface) objc_add_method (interface, copy_node (method), - TREE_CODE (method) == CLASS_METHOD_DECL, + TREE_CODE (method) == CLASS_METHOD_DECL, /* is_optional= */ false); } } @@ -8799,7 +8799,7 @@ get_super_receiver (void) DECL_READ_P (UOBJC_SUPER_decl) = 1; lang_hooks.decls.pushdecl (UOBJC_SUPER_decl); finish_decl (UOBJC_SUPER_decl, input_location, NULL_TREE, NULL_TREE, - NULL_TREE); + NULL_TREE); UOBJC_SUPER_scope = objc_get_current_scope (); } @@ -8821,7 +8821,7 @@ get_super_receiver (void) inst_meth = (TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL); if (TREE_CODE (objc_implementation_context) == CLASS_IMPLEMENTATION_TYPE) - class_expr = (*runtime.get_class_super_ref) (input_location, + class_expr = (*runtime.get_class_super_ref) (input_location, imp_list, inst_meth); else /* We have a category. */ @@ -8837,20 +8837,20 @@ get_super_receiver (void) return error_mark_node; } - super_class = (*runtime.get_category_super_ref) (input_location, + super_class = (*runtime.get_category_super_ref) (input_location, imp_list, inst_meth); - class_expr = build_c_cast (input_location, + class_expr = build_c_cast (input_location, TREE_TYPE (super_expr), super_class); } - super_expr = build_modify_expr (input_location, super_expr, NULL_TREE, + super_expr = build_modify_expr (input_location, super_expr, NULL_TREE, NOP_EXPR, input_location, class_expr, NULL_TREE); - super_expr_list = build_compound_expr (input_location, + super_expr_list = build_compound_expr (input_location, super_expr_list, super_expr); - super_expr = build_unary_op (input_location, + super_expr = build_unary_op (input_location, ADDR_EXPR, UOBJC_SUPER_decl, 0); super_expr_list = build_compound_expr (input_location, super_expr_list, super_expr); @@ -8981,7 +8981,7 @@ gen_type_name_0 (tree type) type = DECL_NAME (type); strcat (errbuf, TREE_CODE (type) == IDENTIFIER_NODE - ? IDENTIFIER_POINTER (type) + ? IDENTIFIER_POINTER (type) : ""); /* For 'id' and 'Class', adopted protocols are stored in the pointee. */ @@ -9150,7 +9150,7 @@ objc_pretty_print_method (bool is_class_method, { if (category_name) { - char *result = XNEWVEC (char, strlen (class_name) + strlen (category_name) + char *result = XNEWVEC (char, strlen (class_name) + strlen (category_name) + strlen (selector) + 7); if (is_class_method) @@ -9170,7 +9170,7 @@ objc_pretty_print_method (bool is_class_method, else sprintf (result, "-[%s %s]", class_name, selector); - return result; + return result; } } #endif @@ -9284,7 +9284,7 @@ objc_demangle (const char *mangled) is impossible to disambiguate. */ for (; *cp; cp++) if (*cp == '_') - *cp = ':'; + *cp = ':'; } *cp++ = ']'; /* closing right brace */ *cp++ = 0; /* string terminator */ @@ -9351,8 +9351,8 @@ objc_printable_name (tree decl, int v) return IDENTIFIER_POINTER (DECL_NAME (decl)); } -/* Routine is called to issue diagnostic when reference to a private - ivar is made and no other variable with same name is found in +/* Routine is called to issue diagnostic when reference to a private + ivar is made and no other variable with same name is found in current scope. */ bool objc_diagnose_private_ivar (tree id) @@ -9363,7 +9363,7 @@ objc_diagnose_private_ivar (tree id) ivar = is_ivar (objc_ivar_chain, id); if (ivar && is_private (ivar)) { - error ("instance variable %qs is declared private", + error ("instance variable %qs is declared private", IDENTIFIER_POINTER (id)); return true; } @@ -9394,7 +9394,7 @@ objc_lookup_ivar (tree other, tree id) /* Look up the ivar, but do not use it if it is not accessible. */ ivar = is_ivar (objc_ivar_chain, id); - + if (!ivar || is_private (ivar)) return other; @@ -9483,7 +9483,7 @@ objc_gimplify_property_ref (tree *expr_p) } #endif gcc_assert (TREE_CODE (call_exp) == CALL_EXPR); - + *expr_p = call_exp; } @@ -9516,7 +9516,7 @@ objc_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) is_gimple_val, fb_rvalue); r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p, post_p, is_gimple_val, fb_rvalue); - + return MIN (r0, r1); } break; @@ -9549,7 +9549,7 @@ objc_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) }; Confusingly enough, NSFastEnumeration is then defined by libraries - to be the same structure. + to be the same structure. */ static void @@ -9558,22 +9558,22 @@ build_fast_enumeration_state_template (void) tree decls, *chain = NULL; /* { */ - objc_fast_enumeration_state_template = objc_start_struct (get_identifier + objc_fast_enumeration_state_template = objc_start_struct (get_identifier (TAG_FAST_ENUMERATION_STATE)); /* unsigned long state; */ decls = add_field_decl (long_unsigned_type_node, "state", &chain); /* id *itemsPtr; */ - add_field_decl (build_pointer_type (objc_object_type), + add_field_decl (build_pointer_type (objc_object_type), "itemsPtr", &chain); /* unsigned long *mutationsPtr; */ - add_field_decl (build_pointer_type (long_unsigned_type_node), + add_field_decl (build_pointer_type (long_unsigned_type_node), "mutationsPtr", &chain); /* unsigned long extra[5]; */ - add_field_decl (build_sized_array_type (long_unsigned_type_node, 5), + add_field_decl (build_sized_array_type (long_unsigned_type_node, 5), "extra", &chain); /* } */ @@ -9594,7 +9594,7 @@ build_fast_enumeration_state_template (void) 'continue'). The syntax is - + for ( in ) @@ -9608,7 +9608,7 @@ build_fast_enumeration_state_template (void) __objc_foreach_collection = ; __objc_foreach_enum_state = { 0 }; __objc_foreach_batchsize = [__objc_foreach_collection countByEnumeratingWithState: &__objc_foreach_enum_state objects: __objc_foreach_items count: 16]; - + if (__objc_foreach_batchsize == 0) = nil; else @@ -9639,7 +9639,7 @@ build_fast_enumeration_state_template (void) the user expects to 'continue' or 'break' the entire foreach loop. We are provided the labels that 'break' and 'continue' jump to, so we place them where we want them to jump to when they pick them. - + Optimization TODO: we could cache the IMP of countByEnumeratingWithState:objects:count:. */ @@ -9652,7 +9652,7 @@ build_fast_enumeration_state_template (void) #endif void -objc_finish_foreach_loop (location_t location, tree object_expression, tree collection_expression, tree for_body, +objc_finish_foreach_loop (location_t location, tree object_expression, tree collection_expression, tree for_body, tree break_label, tree continue_label) { /* A tree representing the __objcFastEnumerationState struct type, @@ -9736,7 +9736,7 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll if (DECL_ORIGINAL_TYPE (objc_NSFastEnumeration_type)) objc_fast_enumeration_state_type = DECL_ORIGINAL_TYPE (objc_NSFastEnumeration_type); else - objc_fast_enumeration_state_type = TREE_TYPE (objc_NSFastEnumeration_type); + objc_fast_enumeration_state_type = TREE_TYPE (objc_NSFastEnumeration_type); } } } @@ -9778,7 +9778,7 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll bind = build3 (BIND_EXPR, void_type_node, objc_foreach_batchsize_decl, NULL, NULL); SET_EXPR_LOCATION (bind, location); TREE_SIDE_EFFECTS (bind) = 1; - + /* __objc_foreach_collection = ; */ t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_collection_decl, collection_expression); SET_EXPR_LOCATION (t, location); @@ -9787,21 +9787,21 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll mark_exp_read (collection_expression); /* __objc_foreach_enum_state.state = 0; */ - t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl, + t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("state")), build_int_cst (long_unsigned_type_node, 0)); SET_EXPR_LOCATION (t, location); append_to_statement_list (t, &BIND_EXPR_BODY (bind)); /* __objc_foreach_enum_state.itemsPtr = NULL; */ - t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl, + t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("itemsPtr")), null_pointer_node); SET_EXPR_LOCATION (t, location); append_to_statement_list (t, &BIND_EXPR_BODY (bind)); /* __objc_foreach_enum_state.mutationsPtr = NULL; */ - t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl, + t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("mutationsPtr")), null_pointer_node); SET_EXPR_LOCATION (t, location); @@ -9815,14 +9815,14 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll for (i = 0; i < 5 ; i++) { t = build2 (MODIFY_EXPR, void_type_node, - build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl, + build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("extra")), build_int_cst (NULL_TREE, i)), build_int_cst (long_unsigned_type_node, 0)); SET_EXPR_LOCATION (t, location); append_to_statement_list (t, &BIND_EXPR_BODY (bind)); } - + /* __objc_foreach_batchsize = [__objc_foreach_collection countByEnumeratingWithState: &__objc_foreach_enum_state objects: __objc_foreach_items count: 16]; */ selector_name = get_identifier ("countByEnumeratingWithState:objects:count:"); #ifdef OBJCPLUS @@ -9855,13 +9855,13 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll append_to_statement_list (t, &BIND_EXPR_BODY (bind)); /* if (__objc_foreach_batchsize == 0) */ - first_if = build3 (COND_EXPR, void_type_node, + first_if = build3 (COND_EXPR, void_type_node, /* Condition. */ - c_fully_fold - (c_common_truthvalue_conversion - (location, + c_fully_fold + (c_common_truthvalue_conversion + (location, build_binary_op (location, - EQ_EXPR, + EQ_EXPR, objc_foreach_batchsize_decl, build_int_cst (long_unsigned_type_node, 0), 1)), false, NULL), @@ -9892,8 +9892,8 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll TREE_SIDE_EFFECTS (first_else) = 1; /* __objc_foreach_mutations_pointer = *__objc_foreach_enum_state.mutationsPtr; */ - t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_mutations_pointer_decl, - build_indirect_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl, + t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_mutations_pointer_decl, + build_indirect_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("mutationsPtr")), RO_UNARY_STAR)); SET_EXPR_LOCATION (t, location); @@ -9901,10 +9901,10 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll /* next_batch: */ next_batch_label_decl = create_artificial_label (location); - t = build1 (LABEL_EXPR, void_type_node, next_batch_label_decl); + t = build1 (LABEL_EXPR, void_type_node, next_batch_label_decl); SET_EXPR_LOCATION (t, location); append_to_statement_list (t, &BIND_EXPR_BODY (first_else)); - + /* { */ /* unsigned long __objc_foreach_index; */ @@ -9929,17 +9929,17 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind)); /* if (__objc_foreach_mutation_pointer != *__objc_foreach_enum_state.mutationsPtr) objc_enumeration_mutation (); */ - t = build3 (COND_EXPR, void_type_node, + t = build3 (COND_EXPR, void_type_node, /* Condition. */ - c_fully_fold - (c_common_truthvalue_conversion - (location, - build_binary_op + c_fully_fold + (c_common_truthvalue_conversion + (location, + build_binary_op (location, - NE_EXPR, + NE_EXPR, objc_foreach_mutations_pointer_decl, - build_indirect_ref (location, - objc_build_component_ref (objc_foreach_enum_state_decl, + build_indirect_ref (location, + objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("mutationsPtr")), RO_UNARY_STAR), 1)), false, NULL), @@ -9953,8 +9953,8 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind)); /* = enumState.itemsPtr[__objc_foreach_index]; */ - t = build2 (MODIFY_EXPR, void_type_node, object_expression, - build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl, + t = build2 (MODIFY_EXPR, void_type_node, object_expression, + build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl, get_identifier ("itemsPtr")), objc_foreach_index_decl)); SET_EXPR_LOCATION (t, location); @@ -9972,7 +9972,7 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll } /* __objc_foreach_index++; */ - t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_index_decl, + t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_index_decl, build_binary_op (location, PLUS_EXPR, objc_foreach_index_decl, @@ -9981,13 +9981,13 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind)); /* if (__objc_foreach_index < __objc_foreach_batchsize) goto next_object; */ - t = build3 (COND_EXPR, void_type_node, + t = build3 (COND_EXPR, void_type_node, /* Condition. */ - c_fully_fold - (c_common_truthvalue_conversion - (location, + c_fully_fold + (c_common_truthvalue_conversion + (location, build_binary_op (location, - LT_EXPR, + LT_EXPR, objc_foreach_index_decl, objc_foreach_batchsize_decl, 1)), false, NULL), @@ -9997,7 +9997,7 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll NULL_TREE); SET_EXPR_LOCATION (t, location); append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind)); - + /* __objc_foreach_batchsize = [__objc_foreach_collection countByEnumeratingWithState: &__objc_foreach_enum_state objects: __objc_foreach_items count: 16]; */ #ifdef OBJCPLUS t = objc_finish_message_expr (objc_foreach_collection_decl, selector_name, @@ -10023,7 +10023,7 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll (NULL_TREE, build_int_cst (NULL_TREE, 16), NULL_TREE))), NULL); } #endif - t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl, + t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl, convert (long_unsigned_type_node, t)); SET_EXPR_LOCATION (t, location); append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind)); @@ -10031,13 +10031,13 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll /* } */ /* if (__objc_foreach_batchsize != 0) goto next_batch; */ - t = build3 (COND_EXPR, void_type_node, + t = build3 (COND_EXPR, void_type_node, /* Condition. */ - c_fully_fold - (c_common_truthvalue_conversion - (location, + c_fully_fold + (c_common_truthvalue_conversion + (location, build_binary_op (location, - NE_EXPR, + NE_EXPR, objc_foreach_batchsize_decl, build_int_cst (long_unsigned_type_node, 0), 1)), false, NULL), @@ -10092,14 +10092,14 @@ objc_string_ref_type_p (tree strp) tmv = TYPE_MAIN_VARIANT (TREE_TYPE (strp)); tmv = OBJC_TYPE_NAME (tmv); return (tmv - && TREE_CODE (tmv) == IDENTIFIER_NODE - && IDENTIFIER_POINTER (tmv) + && TREE_CODE (tmv) == IDENTIFIER_NODE + && IDENTIFIER_POINTER (tmv) && !strncmp (IDENTIFIER_POINTER (tmv), "NSString", 8)); } /* At present the behavior of this is undefined and it does nothing. */ void -objc_check_format_arg (tree ARG_UNUSED (format_arg), +objc_check_format_arg (tree ARG_UNUSED (format_arg), tree ARG_UNUSED (args_list)) { } @@ -10254,7 +10254,7 @@ encode_pointer (tree type, int curtype, int format) /* It appears that "r*" means "const char *" rather than "char *const". "char *const" is encoded as "*", which is identical to "char *", so the "const" is - unfortunately lost. */ + unfortunately lost. */ if (TYPE_READONLY (pointer_to)) obstack_1grow (&util_obstack, 'r'); } @@ -10275,7 +10275,7 @@ encode_array (tree type, int curtype, int format) tree an_int_cst = TYPE_SIZE (type); tree array_of = TREE_TYPE (type); char buffer[40]; - + if (an_int_cst == NULL) { /* We are trying to encode an incomplete array. An incomplete @@ -10304,7 +10304,7 @@ encode_array (tree type, int curtype, int format) */ { char *enc = obstack_base (&util_obstack) + curtype; - if (memchr (enc, '=', + if (memchr (enc, '=', obstack_object_size (&util_obstack) - curtype) == NULL) { /* We are not inside a struct. Encode the array as a @@ -10350,7 +10350,7 @@ encode_vector (tree type, int curtype, int format) sprintf (buffer, "![" HOST_WIDE_INT_PRINT_DEC ",%d", /* We want to compute the equivalent of sizeof (). Code inspired by c_sizeof_or_alignof_type. */ - ((TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)) + ((TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)) / (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT))), /* We want to compute the equivalent of __alignof__ (). Code inspired by @@ -10435,10 +10435,10 @@ encode_aggregate_within (tree type, int curtype, int format, int left, */ char c1 = ob_size > 1 ? *(obstack_next_free (&util_obstack) - 2) : 0; char c0 = ob_size > 0 ? *(obstack_next_free (&util_obstack) - 1) : 0; - + if (c0 == '^' || (c1 == '^' && c0 == 'r')) pointed_to = true; - + if (format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables) { if (!pointed_to) @@ -10647,7 +10647,7 @@ encode_type (tree type, int curtype, int format) obstack_1grow (&util_obstack, '?'); break; } - + if (flag_next_runtime) { /* Super-kludge. Some ObjC qualifier and type combinations need @@ -10655,7 +10655,7 @@ encode_type (tree type, int curtype, int format) if (code == POINTER_TYPE && obstack_object_size (&util_obstack) >= 3) { char *enc = obstack_base (&util_obstack) + curtype; - + /* Rewrite "in const" from "nr" to "rn". */ if (curtype >= 1 && !strncmp (enc - 1, "nr", 2)) strncpy (enc - 1, "rn", 2); @@ -10810,7 +10810,7 @@ objc_v2_encode_prop_attr (tree property) } if (PROPERTY_DYNAMIC (property)) - obstack_grow (&util_obstack, ",D", 2); + obstack_grow (&util_obstack, ",D", 2); if (PROPERTY_NONATOMIC (property)) obstack_grow (&util_obstack, ",N", 2); diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index d604299c464..30c74c58f71 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -129,7 +129,7 @@ typedef enum objc_property_assign_semantics { /* PROPERTY_REF_PROPERTY_DECL is the PROPERTY_DECL for the property used in the expression. From it, you can get the property type, and the getter/setter names. This PROPERTY_DECL could be artificial - if we are processing an 'object.component' syntax with no matching + if we are processing an 'object.component' syntax with no matching declared property. */ #define PROPERTY_REF_PROPERTY_DECL(NODE) TREE_OPERAND (PROPERTY_REF_CHECK (NODE), 1) @@ -524,9 +524,9 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; #define objc_setjmp_decl objc_global_trees[OCTI_SETJMP_DECL] #define objc_stack_exception_data \ objc_global_trees[OCTI_STACK_EXCEPTION_DATA_DECL] -#define objc_caught_exception objc_global_trees[OCTI_LOCAL_EXCEPTION_DECL] -#define objc_rethrow_exception objc_global_trees[OCTI_RETHROW_EXCEPTION_DECL] -#define objc_eval_once objc_global_trees[OCTI_EVAL_ONCE_DECL] +#define objc_caught_exception objc_global_trees[OCTI_LOCAL_EXCEPTION_DECL] +#define objc_rethrow_exception objc_global_trees[OCTI_RETHROW_EXCEPTION_DECL] +#define objc_eval_once objc_global_trees[OCTI_EVAL_ONCE_DECL] #define objc_catch_type objc_global_trees[OCTI_CATCH_TYPE] #define execclass_decl objc_global_trees[OCTI_EXECCLASS_DECL] @@ -643,7 +643,7 @@ typedef enum string_section #define METHOD_REF 1 /* (Decide if these can ever be validly changed.) */ -#define OBJC_ENCODE_INLINE_DEFS 0 +#define OBJC_ENCODE_INLINE_DEFS 0 #define OBJC_ENCODE_DONT_INLINE_DEFS 1 #define BUFSIZE 1024 @@ -668,7 +668,7 @@ typedef enum string_section #define OBJC_VOID_AT_END void_list_node /* Exception handling constructs. We begin by having the parser do most - of the work and passing us blocks. + of the work and passing us blocks. This allows us to handle different exceptions implementations. */ /* Stack of open try blocks. */ @@ -706,7 +706,7 @@ struct objc_try_context than making them externs. */ extern tree objc_create_temporary_var (tree, const char *); - + #define objc_is_object_id(TYPE) (OBJC_TYPE_NAME (TYPE) == objc_object_id) #define objc_is_class_id(TYPE) (OBJC_TYPE_NAME (TYPE) == objc_class_id) diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c index 7fb87611d69..fdeebea18c4 100644 --- a/gcc/objc/objc-gnu-runtime-abi-01.c +++ b/gcc/objc/objc-gnu-runtime-abi-01.c @@ -71,10 +71,10 @@ along with GCC; see the file COPYING3. If not see /* This macro provides a method of removing ambiguity between runtimes when LTO is in use on targets supporting multiple runtimes. - + For example, at present, any target that includes an implementation of the NeXT runtime needs to place Objective-C meta-data into specific - named sections. This should _not_ be done for the GNU runtime, and the + named sections. This should _not_ be done for the GNU runtime, and the folowing macro is used to attach Objective-C private attributes that may be used to identify the runtime for which the meta-data are intended. */ @@ -120,7 +120,7 @@ static tree begin_catch (struct objc_try_context **, tree, tree, tree, bool); static void finish_catch (struct objc_try_context **, tree); static tree finish_try_stmt (struct objc_try_context **); -bool +bool objc_gnu_runtime_abi_01_init (objc_runtime_hooks *rthooks) { /* GNU runtime does not need the compiler to change code in order to do GC. */ @@ -265,14 +265,14 @@ static void gnu_runtime_01_initialize (void) NULL, NULL_TREE); /* id objc_getMetaClass (const char *); */ - objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS, type, + objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE); /* static SEL _OBJC_SELECTOR_TABLE[]; */ build_selector_table_decl (); - - /* Stuff for properties. + + /* Stuff for properties. The codegen relies on this being NULL for GNU. */ objc_copyStruct_decl = NULL_TREE; @@ -281,14 +281,14 @@ static void gnu_runtime_01_initialize (void) type = build_function_type_list (void_type_node, ptr_type_node, const_ptr_type_node, - ptrdiff_type_node, + ptrdiff_type_node, boolean_type_node, boolean_type_node, NULL_TREE); /* Declare the following function: void - objc_getPropertyStruct (void *destination, const void *source, + objc_getPropertyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ objc_getPropertyStruct_decl = add_builtin_function ("objc_getPropertyStruct", type, 0, NOT_BUILT_IN, @@ -296,13 +296,13 @@ static void gnu_runtime_01_initialize (void) TREE_NOTHROW (objc_getPropertyStruct_decl) = 0; /* Declare the following function: void - objc_setPropertyStruct (void *destination, const void *source, + objc_setPropertyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ objc_setPropertyStruct_decl = add_builtin_function ("objc_setPropertyStruct", type, 0, NOT_BUILT_IN, NULL, NULL_TREE); TREE_NOTHROW (objc_setPropertyStruct_decl) = 0; - + using_eh_for_cleanups (); lang_hooks.eh_runtime_type = objc_eh_runtime_type; lang_hooks.eh_personality = objc_eh_personality; @@ -391,7 +391,7 @@ build_class_template (void) /* struct objc_class *sibling_class; */ ptype = build_pointer_type (objc_class_template); add_field_decl (ptype, "sibling_class", &chain); - + /* struct _objc_protocol **protocol_list; */ ptype = build_pointer_type (build_pointer_type (xref_tag (RECORD_TYPE, @@ -504,7 +504,7 @@ gnu_runtime_abi_01_class_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_Class_%s", + snprintf (buf, BUFSIZE, "_OBJC_Class_%s", IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_class_template, buf); OBJCMETA (decl, objc_meta, meta_base); @@ -516,7 +516,7 @@ gnu_runtime_abi_01_metaclass_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s", + snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s", IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_class_template, buf); OBJCMETA (decl, objc_meta, meta_base); @@ -528,7 +528,7 @@ gnu_runtime_abi_01_category_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s", + snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s", IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)), IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_category_template, buf); @@ -551,7 +551,7 @@ gnu_runtime_abi_01_protocol_decl (tree p) } static tree -gnu_runtime_abi_01_string_decl (tree type, const char *name, +gnu_runtime_abi_01_string_decl (tree type, const char *name, string_section where ATTRIBUTE_UNUSED) { tree decl = start_var_decl (type, name); @@ -568,7 +568,7 @@ gnu_runtime_abi_01_get_class_reference (tree ident) add_class_reference (ident); - params = build_tree_list (NULL_TREE, my_build_string_pointer + params = build_tree_list (NULL_TREE, my_build_string_pointer (IDENTIFIER_LENGTH (ident) + 1, IDENTIFIER_POINTER (ident))); @@ -577,7 +577,7 @@ gnu_runtime_abi_01_get_class_reference (tree ident) return build_function_call (input_location, objc_get_class_decl, params); } -/* Used by get_arg_type_list. +/* Used by get_arg_type_list. Return the types for receiver & _cmd at the start of a method argument list. context is either METHOD_DEF or METHOD_REF, saying whether we are trying to define a method or call one. superflag says this is for a send to super. @@ -621,9 +621,9 @@ gnu_runtime_abi_01_build_typed_selector_reference (location_t loc, tree ident, while (*chain) { - /* When we do a lookup for @selector () we have no idea of the + /* When we do a lookup for @selector () we have no idea of the prototype - so match the first we find. */ - if (TREE_VALUE (*chain) == ident + if (TREE_VALUE (*chain) == ident && (!prototype || TREE_PURPOSE (*chain) == prototype)) goto return_at_index; @@ -633,7 +633,7 @@ gnu_runtime_abi_01_build_typed_selector_reference (location_t loc, tree ident, *chain = tree_cons (prototype, ident, NULL_TREE); - /* TODO: Use a vec and keep this in it to (a) avoid re-creating and + /* TODO: Use a vec and keep this in it to (a) avoid re-creating and (b) provide better diagnostics for the first time an undefined selector is used. */ return_at_index: @@ -657,7 +657,7 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype, tree lookup_object, tree selector, tree method_params) { - tree sender = (super_flag ? umsg_super_decl + tree sender = (super_flag ? umsg_super_decl : (flag_objc_direct_dispatch ? umsg_fast_decl : umsg_decl)); tree rcv_p = (super_flag ? objc_super_type : objc_object_type); @@ -673,15 +673,15 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype, ? TREE_VALUE (TREE_TYPE (method_prototype)) : objc_object_type); - tree method_param_types = - get_arg_type_list (method_prototype, METHOD_REF, super_flag); + tree method_param_types = + get_arg_type_list (method_prototype, METHOD_REF, super_flag); tree ftype = build_function_type (ret_type, method_param_types); tree sender_cast; tree method, t; if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype)) - ftype = build_type_attribute_variant (ftype, - METHOD_TYPE_ATTRIBUTES + ftype = build_type_attribute_variant (ftype, + METHOD_TYPE_ATTRIBUTES (method_prototype)); sender_cast = build_pointer_type (ftype); @@ -728,9 +728,9 @@ gnu_runtime_abi_01_build_objc_method_call (location_t loc, tree method_params, int super ATTRIBUTE_UNUSED) { - tree selector = - gnu_runtime_abi_01_build_typed_selector_reference (loc, - sel_name, + tree selector = + gnu_runtime_abi_01_build_typed_selector_reference (loc, + sel_name, method_prototype); return build_objc_method_call (loc, super, method_prototype, receiver, @@ -767,7 +767,7 @@ gnu_runtime_abi_01_get_protocol_reference (location_t loc, tree p) /* This type is a struct containing the fields of a Protocol object. (Cfr. objc_protocol_type instead is the type of a pointer to such a struct). */ - protocol_struct_type = xref_tag (RECORD_TYPE, + protocol_struct_type = xref_tag (RECORD_TYPE, get_identifier (PROTOCOL_OBJECT_CLASS_NAME)); /* Look for the list of Protocol statically allocated instances @@ -797,7 +797,7 @@ gnu_runtime_abi_01_get_protocol_reference (location_t loc, tree p) /* For ABI 8 an IVAR is just a fixed offset in the class struct. */ static tree -gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, +gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, tree base, tree id) { return objc_build_component_ref (base, id); @@ -807,29 +807,29 @@ gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, built for the sake of efficiency). */ static tree -gnu_runtime_abi_01_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED, +gnu_runtime_abi_01_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED, struct imp_entry *imp, bool inst_meth) { if (inst_meth) { if (!ucls_super_ref) - ucls_super_ref = - objc_build_component_ref (imp->class_decl, + ucls_super_ref = + objc_build_component_ref (imp->class_decl, get_identifier ("super_class")); return ucls_super_ref; } else { if (!uucls_super_ref) - uucls_super_ref = - objc_build_component_ref (imp->meta_decl, + uucls_super_ref = + objc_build_component_ref (imp->meta_decl, get_identifier ("super_class")); return uucls_super_ref; } } static tree -gnu_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, +gnu_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, struct imp_entry *imp, bool inst_meth) { tree super_name = CLASS_SUPER_NAME (imp->imp_template); @@ -886,7 +886,7 @@ objc_add_static_instance (tree constructor, tree class_decl) OBJCMETA (decl, objc_meta, meta_base); /* We may be writing something else just now. - Postpone till end of input. */ + Postpone till end of input. */ DECL_DEFER_OUTPUT (decl) = 1; pushdecl_top_level (decl); rest_of_decl_compilation (decl, 1, 0); @@ -903,13 +903,13 @@ gnu_runtime_abi_01_build_const_string_constructor (location_t loc, tree string, { tree constructor, fields; VEC(constructor_elt,gc) *v = NULL; - + /* GNU: (NXConstantString *) & ((__builtin_ObjCString) { NULL, string, length }) */ fields = TYPE_FIELDS (internal_const_str_type); CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0)); fields = DECL_CHAIN (fields); - CONSTRUCTOR_APPEND_ELT (v, fields, build_unary_op (loc, + CONSTRUCTOR_APPEND_ELT (v, fields, build_unary_op (loc, ADDR_EXPR, string, 1)); fields = DECL_CHAIN (fields); @@ -1035,9 +1035,9 @@ handle_impent (struct imp_entry *impent) { const char *const class_name = IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)); - + string = (char *) alloca (strlen (class_name) + 30); - + sprintf (string, "__objc_class_name_%s", class_name); break; } @@ -1047,10 +1047,10 @@ handle_impent (struct imp_entry *impent) IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)); const char *const class_super_name = IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context)); - + string = (char *) alloca (strlen (class_name) + strlen (class_super_name) + 30); - + /* Do the same for categories. Even though no references to these symbols are generated automatically by the compiler, it gives you a handle to pull them into an archive by @@ -1093,7 +1093,7 @@ build_protocol_initializer (tree type, tree protocol_name, tree protocol_list, /* TODO: pass the loc in or find it from args. */ loc = input_location; - ttyp = build_pointer_type (xref_tag (RECORD_TYPE, + ttyp = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier (UTAG_CLASS))); /* Filling the "isa" in with a version allows the runtime system to detect this ... */ @@ -1171,15 +1171,15 @@ generate_protocol_list (tree i_or_p, tree klass_ctxt) switch (TREE_CODE (i_or_p)) { case PROTOCOL_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s", + snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (i_or_p))); break; case CLASS_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s", + snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s", IDENTIFIER_POINTER (CLASS_NAME (i_or_p))); break; case CATEGORY_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s", + snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s", IDENTIFIER_POINTER (CLASS_NAME (klass_ctxt)), IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass_ctxt))); break; @@ -1197,7 +1197,7 @@ generate_protocol_list (tree i_or_p, tree klass_ctxt) return refs_decl; } -static tree +static tree generate_v1_meth_descriptor_table (tree chain, tree protocol, const char *prefix) { tree method_list_template, initlist, decl; @@ -1210,18 +1210,18 @@ generate_v1_meth_descriptor_table (tree chain, tree protocol, const char *prefix if (!objc_method_prototype_template) objc_method_prototype_template = build_method_prototype_template (); - + size = list_length (chain); - method_list_template = + method_list_template = build_method_prototype_list_template (objc_method_prototype_template, size); - snprintf (buf, BUFSIZE, "%s_%s", prefix, + snprintf (buf, BUFSIZE, "%s_%s", prefix, IDENTIFIER_POINTER (PROTOCOL_NAME (protocol))); decl = start_var_decl (method_list_template, buf); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size)); - initlist = + initlist = build_descriptor_table_initializer (objc_method_prototype_template, chain); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist); @@ -1300,7 +1300,7 @@ generate_protocols (void) nst_methods = DECL_CHAIN (nst_methods); } - UOBJC_INSTANCE_METHODS_decl = + UOBJC_INSTANCE_METHODS_decl = generate_v1_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p, "_OBJC_PROTOCOL_INSTANCE_METHODS"); @@ -1315,7 +1315,7 @@ generate_protocols (void) cls_methods = DECL_CHAIN (cls_methods); } - UOBJC_CLASS_METHODS_decl = + UOBJC_CLASS_METHODS_decl = generate_v1_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p, "_OBJC_PROTOCOL_CLASS_METHODS"); /* generate_method_descriptors (p);*/ @@ -1363,7 +1363,7 @@ generate_dispatch_table (tree chain, const char *name) decl = start_var_decl (method_list_template, name); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node); - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, size)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist); @@ -1515,24 +1515,24 @@ build_shared_structure_initializer (tree type, tree isa, tree super, /* objc_ivar_list = */ if (!ivar_list) - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (objc_ivar_list_ptr, 0)); else { expr = convert (objc_ivar_list_ptr, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, ADDR_EXPR, ivar_list, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } /* objc_method_list = */ if (!dispatch_table) - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, convert (objc_method_list_ptr, null_pointer_node)); else { expr = convert (objc_method_list_ptr, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, ADDR_EXPR, dispatch_table, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } @@ -1564,7 +1564,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, else { expr = convert (ltyp, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, ADDR_EXPR, protocol_list, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } @@ -1627,14 +1627,14 @@ generate_class_structures (struct imp_entry *impent) location_t loc; char buf[BUFSIZE]; int cls_flags = 0 ; - + /* objc_implementation_context = impent->imp_context; implementation_template = impent->imp_template;*/ class_decl = impent->class_decl; meta_decl = impent->meta_decl; /* UOBJC_CLASS_decl = impent->class_decl; UOBJC_METACLASS_decl = impent->meta_decl;*/ - + loc = DECL_SOURCE_LOCATION (impent->class_decl); my_super_id = CLASS_SUPER_NAME (impent->imp_template); @@ -1670,7 +1670,7 @@ generate_class_structures (struct imp_entry *impent) super_expr = add_objc_string (my_super_id, class_names); else super_expr = null_pointer_node; - + super_expr = build_c_cast (loc, cast_type, super_expr); root_expr = add_objc_string (my_root_id, class_names); @@ -1703,11 +1703,11 @@ generate_class_structures (struct imp_entry *impent) /* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */ - initlist = - build_shared_structure_initializer + initlist = + build_shared_structure_initializer (TREE_TYPE (meta_decl), root_expr, super_expr, name_expr, - convert (integer_type_node, + convert (integer_type_node, TYPE_SIZE_UNIT (objc_class_template)), CLS_META, class_methods, class_ivars, protocol_decl); @@ -1731,8 +1731,8 @@ generate_class_structures (struct imp_entry *impent) inst_ivars = generate_ivars_list (chain, buf); } - initlist = - build_shared_structure_initializer + initlist = + build_shared_structure_initializer (TREE_TYPE (class_decl), build_unary_op (loc, ADDR_EXPR, meta_decl, 0), super_expr, name_expr, @@ -1777,7 +1777,7 @@ handle_class_ref (tree chain) DECL_READ_P (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_INITIAL (decl) = error_mark_node; - + /* We must force the reference. */ DECL_PRESERVE_P (decl) = 1; @@ -1831,7 +1831,7 @@ build_gnu_selector_translation_table (void) CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, encoding); expr = objc_build_constructor (objc_selector_template, v); - + CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); } /* each element in the chain */ @@ -1880,7 +1880,7 @@ generate_static_references (void) klass = TREE_VALUE (cl_chain); class_name = get_objc_string_decl (OBJC_TYPE_NAME (klass), class_names); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, - build_unary_op (input_location, + build_unary_op (input_location, ADDR_EXPR, class_name, 1)); /* Output {..., instance, ...}. */ @@ -2019,7 +2019,7 @@ init_objc_symtab (tree type) ltyp = build_pointer_type (objc_selector_type); if (sel_ref_chain) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, + expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, UOBJC_SELECTOR_TABLE_decl, 1)); else expr = convert (ltyp, null_pointer_node); @@ -2027,12 +2027,12 @@ init_objc_symtab (tree type) /* cls_def_cnt = { ..., 5, ... } */ - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (short_integer_type_node, imp_count)); /* cat_def_cnt = { ..., 5, ... } */ - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (short_integer_type_node, cat_count)); /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */ @@ -2110,7 +2110,7 @@ objc_generate_v1_gnu_metadata (void) { /* Make sure that the meta-data are identified as being GNU-runtime. */ - build_module_descriptor (OBJC_VERSION, + build_module_descriptor (OBJC_VERSION, build_tree_list (objc_meta, meta_base)); build_module_initializer_routine (); } @@ -2156,7 +2156,7 @@ objc_eh_runtime_type (tree type) if (POINTER_TYPE_P (type) && objc_is_object_id (TREE_TYPE (type))) /* We don't want to identify 'id' for GNU. Instead, build a 0 entry in the exceptions table. */ - return null_pointer_node; + return null_pointer_node; if (!POINTER_TYPE_P (type) || !TYPED_OBJECT (TREE_TYPE (type))) { @@ -2229,7 +2229,7 @@ objc_build_exc_ptr (struct objc_try_context **x ATTRIBUTE_UNUSED) return fold_convert (objc_object_type, t); } -static tree +static tree begin_catch (struct objc_try_context **cur_try_context, tree type, tree decl, tree compound, bool ellipsis ATTRIBUTE_UNUSED) { @@ -2248,13 +2248,13 @@ begin_catch (struct objc_try_context **cur_try_context, tree type, return build2 (MODIFY_EXPR, void_type_node, decl, t); } -static void +static void finish_catch (struct objc_try_context **cur_try_context, tree current_catch) { append_to_statement_list (current_catch, &((*cur_try_context)->catch_list)); } -static tree +static tree finish_try_stmt (struct objc_try_context **cur_try_context) { struct objc_try_context *c = *cur_try_context; diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 169b8940677..b1bbb9e1fc0 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -46,7 +46,7 @@ enum c_language_kind c_language = clk_objc; #define LANG_HOOKS_INIT objc_init #undef LANG_HOOKS_DECL_PRINTABLE_NAME #define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name -#undef LANG_HOOKS_GIMPLIFY_EXPR +#undef LANG_HOOKS_GIMPLIFY_EXPR #define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr #undef LANG_HOOKS_INIT_TS #define LANG_HOOKS_INIT_TS objc_common_init_ts diff --git a/gcc/objc/objc-next-metadata-tags.h b/gcc/objc/objc-next-metadata-tags.h index db0026ec609..c43ab184cfb 100644 --- a/gcc/objc/objc-next-metadata-tags.h +++ b/gcc/objc/objc-next-metadata-tags.h @@ -1,6 +1,6 @@ /* Declarations for meta-data attribute tags. Copyright (C) 2011 Free Software Foundation, Inc. - Contributed by Iain Sandoe + Contributed by Iain Sandoe This file is part of GCC. @@ -25,29 +25,29 @@ enum objc_runtime_tree_index { OCTI_RT_OBJC_META, OCTI_RT_META_BASE, - + OCTI_RT_META_CLASS, OCTI_RT_META_METACLASS, OCTI_RT_META_CATEGORY, OCTI_RT_META_PROTOCOL, - + OCTI_RT_META_CLASS_CLS_VARS, OCTI_RT_META_CLASS_NST_VARS, - + OCTI_RT_META_CLASS_CLS_METH, OCTI_RT_META_CLASS_NST_METH, OCTI_RT_META_CATEG_CLS_METH, OCTI_RT_META_CATEG_NST_METH, OCTI_RT_META_PROTO_CLS_METH, OCTI_RT_META_PROTO_NST_METH, - + OCTI_RT_META_CLASS_PROT, OCTI_RT_META_CATEG_PROT, OCTI_RT_META_PROT_REFS, - + OCTI_RT_META_MSG_REFS, OCTI_RT_META_SEL_REFS, - + OCTI_RT_META_CLSLST_REFS, OCTI_RT_META_CLASS_REF, OCTI_RT_META_SUPER_REF, @@ -56,34 +56,34 @@ enum objc_runtime_tree_index OCTI_RT_META_LAB_PROTOLIST, OCTI_RT_META_LAB_NLZY_CAT, OCTI_RT_META_LAB_CAT, - + OCTI_RT_META_PROPERTY_LIST, OCTI_RT_META_PROTOCOL_EXT, OCTI_RT_META_CLASS_EXT, - + OCTI_RT_META_CLASS_NAME, OCTI_RT_META_METHD_NAME, OCTI_RT_META_METHD_TYPE, OCTI_RT_META_PROPN_ATTR, - + OCTI_RT_META_MODULES, OCTI_RT_META_SYMTAB, OCTI_RT_META_INFO, - + OCTI_RT_META_EHTYPE, - + OCTI_RT_META_CONST_STR, OCTI_RT_META_MAX }; /* Tags for the META data so that the backend can put them in the correct - sections for targets/runtimes (Darwin/NeXT) that require this. + sections for targets/runtimes (Darwin/NeXT) that require this. This information also survives LTO - which might produce mixed language output. */ /* Objective-C meta data attribute tag */ -#define objc_meta objc_rt_trees[OCTI_RT_OBJC_META] +#define objc_meta objc_rt_trees[OCTI_RT_OBJC_META] /* Attribute values, base = default section. */ #define meta_base objc_rt_trees[OCTI_RT_META_BASE] diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c index 3bab0a92d5e..4fb2a38541f 100644 --- a/gcc/objc/objc-next-runtime-abi-01.c +++ b/gcc/objc/objc-next-runtime-abi-01.c @@ -140,13 +140,13 @@ static tree begin_catch (struct objc_try_context **, tree, tree, tree, bool); static void finish_catch (struct objc_try_context **, tree); static tree finish_try_stmt (struct objc_try_context **); -bool +bool objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks) { - if (flag_objc_exceptions + if (flag_objc_exceptions && !flag_objc_sjlj_exceptions) { - warning_at (UNKNOWN_LOCATION, OPT_Wall, + warning_at (UNKNOWN_LOCATION, OPT_Wall, "%<-fobjc-sjlj-exceptions%> is the only supported exceptions " "system for %<-fnext-runtime%> with %<-fobjc-abi-version%> < 2"); } @@ -192,7 +192,7 @@ objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks) given variable, since each type is expected (by the runtime) to be found in a specific named section. The solution must be usable with LTO. - + The scheme used for NeXT ABI 0/1 (partial matching of variable names) is not satisfactory for LTO & ABI-2. We now tag ObjC meta-data with identification attributes in the front end. The @@ -233,15 +233,15 @@ next_runtime_abi_01_init_metadata_attributes (void) meta_meth_name = get_identifier ("V1_METN"); meta_meth_type = get_identifier ("V1_METT"); meta_prop_name_attr = get_identifier ("V1_STRG"); - + meta_modules = get_identifier ("V1_MODU"); meta_symtab = get_identifier ("V1_SYMT"); meta_info = get_identifier ("V1_INFO"); - + meta_proplist = get_identifier ("V1_PLST"); meta_protocol_extension = get_identifier ("V1_PEXT"); meta_class_extension = get_identifier ("V1_CEXT"); - + meta_const_str = get_identifier ("V1_CSTR"); } @@ -366,13 +366,13 @@ static void next_runtime_01_initialize (void) type = build_function_type_list (void_type_node, ptr_type_node, const_ptr_type_node, - ptrdiff_type_node, + ptrdiff_type_node, boolean_type_node, boolean_type_node, NULL_TREE); /* Declare the following function: void - objc_copyStruct (void *destination, const void *source, + objc_copyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ objc_copyStruct_decl = add_builtin_function ("objc_copyStruct", type, 0, NOT_BUILT_IN, @@ -390,7 +390,7 @@ static void next_runtime_01_initialize (void) /* --- templates --- */ -/* struct _objc_class +/* struct _objc_class { struct _objc_class *isa; struct _objc_class *super_class; @@ -520,11 +520,11 @@ build_v1_category_template (void) if (flag_objc_abi >= 1) { add_field_decl (integer_type_node, "size", &chain); - + /* struct _objc_property_list *instance_properties; This field describes a category's @property declarations. Properties from inherited protocols are not included. */ - ptype = build_pointer_type (xref_tag (RECORD_TYPE, + ptype = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier (UTAG_PROPERTY_LIST))); add_field_decl (ptype, "instance_properties", &chain); } @@ -540,7 +540,7 @@ build_v1_category_template (void) struct _objc_protocol_extension *isa; #else struct _objc_class *isa; - #endif + #endif char *protocol_name; struct _objc_protocol **protocol_list; @@ -597,7 +597,7 @@ next_runtime_abi_01_class_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_Class_%s", + snprintf (buf, BUFSIZE, "_OBJC_Class_%s", IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_class_template, buf); OBJCMETA (decl, objc_meta, meta_class); @@ -609,7 +609,7 @@ next_runtime_abi_01_metaclass_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s", + snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s", IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_class_template, buf); OBJCMETA (decl, objc_meta, meta_metaclass); @@ -621,7 +621,7 @@ next_runtime_abi_01_category_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s", + snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s", IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)), IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_category_template, buf); @@ -662,7 +662,7 @@ next_runtime_abi_01_string_decl (tree type, const char *name, string_section wh case prop_names_attr: OBJCMETA (var, objc_meta, meta_prop_name_attr); break; - default: + default: OBJCMETA (var, objc_meta, meta_base); break; } @@ -721,7 +721,7 @@ next_runtime_abi_01_get_class_reference (tree ident) } } -/* Used by get_arg_type_list. +/* Used by get_arg_type_list. Return the types for receiver & _cmd at the start of a method argument list. context is either METHOD_DEF or METHOD_REF, saying whether we are trying to define a method or call one. superflag says this is for a send to super. @@ -771,7 +771,7 @@ build_selector_reference_decl (tree ident) t = buf; while (*t) { - if (*t==':') + if (*t==':') *t = '$'; /* Underscore would clash between foo:bar and foo_bar. */ t++; } @@ -829,13 +829,13 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype, ? TREE_VALUE (TREE_TYPE (method_prototype)) : objc_object_type); - tree method_param_types = - get_arg_type_list (method_prototype, METHOD_REF, super_flag); + tree method_param_types = + get_arg_type_list (method_prototype, METHOD_REF, super_flag); tree ftype = build_function_type (ret_type, method_param_types); if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype)) - ftype = build_type_attribute_variant (ftype, - METHOD_TYPE_ATTRIBUTES + ftype = build_type_attribute_variant (ftype, + METHOD_TYPE_ATTRIBUTES (method_prototype)); sender_cast = build_pointer_type (ftype); @@ -858,11 +858,11 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype, || TREE_CODE (ret_type) == UNION_TYPE) && targetm.calls.return_in_memory (ret_type, 0)) sender = (super_flag ? umsg_super_stret_decl - : flag_nil_receivers ? umsg_stret_decl + : flag_nil_receivers ? umsg_stret_decl : umsg_nonnil_stret_decl); else - sender = (super_flag ? umsg_super_decl - : (flag_nil_receivers ? (flag_objc_direct_dispatch + sender = (super_flag ? umsg_super_decl + : (flag_nil_receivers ? (flag_objc_direct_dispatch ? umsg_fast_decl : umsg_decl) : umsg_nonnil_decl)); @@ -878,7 +878,7 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype, VEC_quick_push (tree, parms, TREE_VALUE (method_params)); /* Build an obj_type_ref, with the correct cast for the method call. */ - t = build3 (OBJ_TYPE_REF, sender_cast, method, + t = build3 (OBJ_TYPE_REF, sender_cast, method, lookup_object, size_zero_node); t = build_function_call_vec (loc, t, parms, NULL); VEC_free (tree, gc, parms); @@ -916,7 +916,7 @@ next_runtime_abi_01_get_protocol_reference (location_t loc, tree p) /* For ABI 0/1 and IVAR is just a fixed offset in the class struct. */ static tree -next_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, +next_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, tree base, tree id) { return objc_build_component_ref (base, id); @@ -932,23 +932,23 @@ next_runtime_abi_01_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED, if (inst_meth) { if (!ucls_super_ref) - ucls_super_ref = - objc_build_component_ref (imp->class_decl, + ucls_super_ref = + objc_build_component_ref (imp->class_decl, get_identifier ("super_class")); return ucls_super_ref; } else { if (!uucls_super_ref) - uucls_super_ref = - objc_build_component_ref (imp->meta_decl, + uucls_super_ref = + objc_build_component_ref (imp->meta_decl, get_identifier ("super_class")); return uucls_super_ref; } } static tree -next_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, +next_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, struct imp_entry *imp, bool inst_meth) { tree super_name = CLASS_SUPER_NAME (imp->imp_template); @@ -959,16 +959,16 @@ next_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, super_class = objc_get_class_reference (super_name); if (!inst_meth) - + /* If we are in a class method, we must retrieve the _metaclass_ for the current class, pointed at by the class's "isa" pointer. The following assumes that "isa" is the first ivar in a class (which it must be). */ - super_class = + super_class = build_indirect_ref (input_location, build_c_cast (input_location, build_pointer_type (objc_class_type), - super_class), + super_class), RO_UNARY_STAR); return super_class; } @@ -1035,7 +1035,7 @@ next_runtime_abi_01_build_const_string_constructor (location_t loc, tree string, /* This routine builds the following type: struct _prop_t { const char * const name; // property name - const char * const attributes; // comma-delimited, encoded, + const char * const attributes; // comma-delimited, encoded, // property attributes }; */ @@ -1072,12 +1072,12 @@ build_v1_property_template (void) static GTY(()) tree objc_protocol_extension_template; -static void +static void build_v1_objc_protocol_extension_template (void) { tree decls, *chain = NULL; - - objc_protocol_extension_template = + + objc_protocol_extension_template = objc_start_struct (get_identifier (UTAG_PROTOCOL_EXT)); /* uint32_t size; */ @@ -1096,7 +1096,7 @@ build_v1_objc_protocol_extension_template (void) } /* This routine build following struct type: - struct _objc_class_ext + struct _objc_class_ext { uint32_t size; // sizeof(struct _objc_class_ext) const char *weak_ivar_layout; @@ -1140,7 +1140,7 @@ build_metadata_templates (void) /* --- emit metadata --- */ -static tree +static tree generate_v1_meth_descriptor_table (tree chain, tree protocol, const char *prefix, tree attr) { @@ -1154,18 +1154,18 @@ generate_v1_meth_descriptor_table (tree chain, tree protocol, if (!objc_method_prototype_template) objc_method_prototype_template = build_method_prototype_template (); - + size = list_length (chain); - method_list_template = + method_list_template = build_method_prototype_list_template (objc_method_prototype_template, size); - snprintf (buf, BUFSIZE, "%s_%s", prefix, + snprintf (buf, BUFSIZE, "%s_%s", prefix, IDENTIFIER_POINTER (PROTOCOL_NAME (protocol))); decl = start_var_decl (method_list_template, buf); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size)); - initlist = + initlist = build_descriptor_table_initializer (objc_method_prototype_template, chain); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist); @@ -1180,7 +1180,7 @@ generate_v1_meth_descriptor_table (tree chain, tree protocol, or NULL_TREE if none are present. */ static tree -generate_v1_objc_protocol_extension (tree proto_interface, +generate_v1_objc_protocol_extension (tree proto_interface, tree opt_instance_meth, tree opt_class_meth, tree instance_props) @@ -1196,7 +1196,7 @@ generate_v1_objc_protocol_extension (tree proto_interface, return NULL_TREE; if (!objc_protocol_extension_template) - build_v1_objc_protocol_extension_template (); + build_v1_objc_protocol_extension_template (); /* uint32_t size */ size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_protocol_extension_template)); @@ -1204,10 +1204,10 @@ generate_v1_objc_protocol_extension (tree proto_interface, /* Try for meaningful diagnostics. */ loc = DECL_SOURCE_LOCATION (PROTOCOL_FORWARD_DECL (proto_interface)); - + /* struct objc_method_list *optional_instance_methods; */ if (opt_instance_meth) - expr = convert (objc_method_list_ptr, + expr = convert (objc_method_list_ptr, build_unary_op (loc, ADDR_EXPR, opt_instance_meth, 0)); else expr = convert (objc_method_list_ptr, null_pointer_node); @@ -1216,7 +1216,7 @@ generate_v1_objc_protocol_extension (tree proto_interface, /* struct objc_method_list *optional_class_methods; */ if (opt_class_meth) - expr = convert (objc_method_list_ptr, + expr = convert (objc_method_list_ptr, build_unary_op (loc, ADDR_EXPR, opt_class_meth, 0)); else expr = convert (objc_method_list_ptr, null_pointer_node); @@ -1224,7 +1224,7 @@ generate_v1_objc_protocol_extension (tree proto_interface, CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); /* struct objc_prop_list *instance_properties; */ if (instance_props) - expr = convert (objc_prop_list_ptr, + expr = convert (objc_prop_list_ptr, build_unary_op (loc, ADDR_EXPR, instance_props, 0)); else expr = convert (objc_prop_list_ptr, null_pointer_node); @@ -1256,7 +1256,7 @@ build_v1_property_list_template (tree list_type, int size) /* anonymous. */ property_list_t_record = objc_start_struct (NULL_TREE); - + /* uint32_t const entsize */ decls = add_field_decl (integer_type_node, "entsize", &chain); @@ -1290,11 +1290,11 @@ build_v1_property_table_initializer (tree type, tree context) VEC(constructor_elt,gc) *elemlist = NULL; tree attribute, name_ident = PROPERTY_NAME (x); - CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, add_objc_string (name_ident, prop_names_attr)); attribute = objc_v2_encode_prop_attr (x); - CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, add_objc_string (attribute, prop_names_attr)); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, @@ -1317,7 +1317,7 @@ generate_v1_property_table (tree context, tree klass_ctxt) VEC(constructor_elt,gc) *inits = NULL; int init_val, size = 0; char buf[BUFSIZE]; - + if (context) { gcc_assert (TREE_CODE (context) == PROTOCOL_INTERFACE_TYPE); @@ -1334,10 +1334,10 @@ generate_v1_property_table (tree context, tree klass_ctxt) return NULL_TREE; if (!objc_v1_property_template) - objc_v1_property_template = build_v1_property_template (); + objc_v1_property_template = build_v1_property_template (); - property_list_template = - build_v1_property_list_template (objc_v1_property_template, + property_list_template = + build_v1_property_list_template (objc_v1_property_template, size); initlist = build_v1_property_table_initializer (objc_v1_property_template, is_proto ? context @@ -1411,17 +1411,17 @@ generate_v1_protocol_list (tree i_or_p, tree klass_ctxt) switch (TREE_CODE (i_or_p)) { case PROTOCOL_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s", + snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (i_or_p))); attr = meta_proto_ref; break; case CLASS_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s", + snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s", IDENTIFIER_POINTER (CLASS_NAME (i_or_p))); attr = meta_clas_prot; break; case CATEGORY_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s", + snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s", IDENTIFIER_POINTER (CLASS_NAME (klass_ctxt)), IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass_ctxt))); attr = meta_catg_prot; @@ -1449,9 +1449,9 @@ build_v1_protocol_initializer (tree type, tree protocol_name, tree protocol_list tree expr, ttyp; location_t loc; VEC(constructor_elt,gc) *inits = NULL; - + if (!objc_protocol_extension_template) - build_v1_objc_protocol_extension_template (); + build_v1_objc_protocol_extension_template (); /* TODO: find a better representation of location from the inputs. */ loc = UNKNOWN_LOCATION; @@ -1483,7 +1483,7 @@ build_v1_protocol_initializer (tree type, tree protocol_name, tree protocol_list return objc_build_constructor (type, inits); } -/* An updated version of generate_protocols () that emit the protocol +/* An updated version of generate_protocols () that emit the protocol extension for ABI=1. */ /* For each protocol which was referenced either from a @protocol() @@ -1551,7 +1551,7 @@ generate_v1_protocols (void) nst_methods = TREE_CHAIN (nst_methods); } - UOBJC_INSTANCE_METHODS_decl = + UOBJC_INSTANCE_METHODS_decl = generate_v1_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p, "_OBJC_ProtocolInstanceMethods", meta_proto_nst_meth); @@ -1567,18 +1567,18 @@ generate_v1_protocols (void) cls_methods = TREE_CHAIN (cls_methods); } - UOBJC_CLASS_METHODS_decl = + UOBJC_CLASS_METHODS_decl = generate_v1_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p, "_OBJC_ProtocolClassMethods", meta_proto_cls_meth); - /* There should be no optional methods for ABI-0 - but we need to + /* There should be no optional methods for ABI-0 - but we need to check all this here before the lists are made. */ nst_methods = PROTOCOL_OPTIONAL_NST_METHODS (p); while (nst_methods) { if (! METHOD_ENCODING (nst_methods)) - { + { encoding = encode_method_prototype (nst_methods); METHOD_ENCODING (nst_methods) = encoding; } @@ -1591,7 +1591,7 @@ generate_v1_protocols (void) meta_proto_nst_meth); cls_methods = PROTOCOL_OPTIONAL_CLS_METHODS (p); - while (cls_methods) + while (cls_methods) { if (! METHOD_ENCODING (cls_methods)) { @@ -1602,7 +1602,7 @@ generate_v1_protocols (void) cls_methods = TREE_CHAIN (cls_methods); } - V1_Protocol_OPT_CLS_METHODS_decl = + V1_Protocol_OPT_CLS_METHODS_decl = generate_v1_meth_descriptor_table (PROTOCOL_OPTIONAL_CLS_METHODS (p), p, "_OBJC_OptionalProtocolClassMethods", meta_proto_cls_meth); @@ -1623,11 +1623,11 @@ generate_v1_protocols (void) build_unary_op (loc, ADDR_EXPR, refs_decl, 0)); else refs_expr = convert (refs_type, null_pointer_node); - + if (flag_objc_abi < 1) { /* Original ABI. */ - initlist = + initlist = build_protocol_initializer (TREE_TYPE (decl), protocol_name_expr, refs_expr, UOBJC_INSTANCE_METHODS_decl, @@ -1638,13 +1638,13 @@ generate_v1_protocols (void) /* else - V1 extensions. */ - V1_Property_decl = + V1_Property_decl = generate_v1_property_table (p, NULL_TREE); - V1_ProtocolExt_decl = - generate_v1_objc_protocol_extension (p, + V1_ProtocolExt_decl = + generate_v1_objc_protocol_extension (p, V1_Protocol_OPT_NST_METHODS_decl, - V1_Protocol_OPT_CLS_METHODS_decl, + V1_Protocol_OPT_CLS_METHODS_decl, V1_Property_decl); initlist = build_v1_protocol_initializer (TREE_TYPE (decl), @@ -1676,7 +1676,7 @@ generate_dispatch_table (tree chain, const char *name, tree attr) decl = start_var_decl (method_list_template, name); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node); - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, size)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist); @@ -1814,7 +1814,7 @@ generate_objc_class_ext (tree property_list, tree context) /* TODO: pass the loc in or find it from args. */ loc = UNKNOWN_LOCATION; - /* const char *weak_ivar_layout + /* const char *weak_ivar_layout TODO: Figure the ivar layouts out... */ weak_ivar_layout_tree = NULL_TREE; @@ -1834,7 +1834,7 @@ generate_objc_class_ext (tree property_list, tree context) else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); - + /* struct _prop_list_t *properties; */ ltyp = objc_prop_list_ptr; if (property_list) @@ -1922,7 +1922,7 @@ build_v1_shared_structure_initializer (tree type, tree isa, tree super, expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); - ltyp = build_pointer_type (xref_tag (RECORD_TYPE, + ltyp = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier ("objc_cache"))); /* method_cache = */ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, convert (ltyp, null_pointer_node)); @@ -2007,15 +2007,15 @@ generate_v1_class_structs (struct imp_entry *impent) int cls_flags; location_t loc; char buf[BUFSIZE]; - + /* objc_implementation_context = impent->imp_context; implementation_template = impent->imp_template;*/ class_decl = impent->class_decl; meta_decl = impent->meta_decl; cls_flags = impent->has_cxx_cdtors ? CLS_HAS_CXX_STRUCTORS : 0 ; - + loc = DECL_SOURCE_LOCATION (impent->class_decl); - + if (flag_objc_abi >= 1) { /* ABI=1 additions. */ @@ -2089,7 +2089,7 @@ generate_v1_class_structs (struct imp_entry *impent) /* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */ - initlist = build_v1_shared_structure_initializer + initlist = build_v1_shared_structure_initializer (TREE_TYPE (meta_decl), root_expr, super_expr, name_expr, convert (integer_type_node, TYPE_SIZE_UNIT (objc_class_template)), @@ -2119,7 +2119,7 @@ generate_v1_class_structs (struct imp_entry *impent) (TREE_TYPE (class_decl), build_unary_op (loc, ADDR_EXPR, meta_decl, 0), super_expr, name_expr, - convert (integer_type_node, + convert (integer_type_node, TYPE_SIZE_UNIT (CLASS_STATIC_TEMPLATE (impent->imp_template))), CLS_FACTORY | cls_flags, inst_methods, inst_ivars, protocol_decl, class_ext_decl); @@ -2225,18 +2225,18 @@ init_objc_symtab (tree type) /* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */ - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, convert (build_pointer_type (objc_selector_type), integer_zero_node)); /* cls_def_cnt = { ..., 5, ... } */ - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (short_integer_type_node, imp_count)); /* cat_def_cnt = { ..., 5, ... } */ - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (short_integer_type_node, cat_count)); /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */ @@ -2291,11 +2291,11 @@ handle_next_impent (struct imp_entry *impent) switch (TREE_CODE (impent->imp_context)) { case CLASS_IMPLEMENTATION_TYPE: - snprintf (buf, BUFSIZE, ".objc_class_name_%s", + snprintf (buf, BUFSIZE, ".objc_class_name_%s", IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))); break; case CATEGORY_IMPLEMENTATION_TYPE: - snprintf (buf, BUFSIZE, "*.objc_category_name_%s_%s", + snprintf (buf, BUFSIZE, "*.objc_category_name_%s_%s", IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)), IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context))); break; @@ -2345,7 +2345,7 @@ generate_objc_image_info (void) | (flag_objc_gc ? 2 : 0)); VEC(constructor_elt,gc) *v = NULL; tree array_type; - + array_type = build_sized_array_type (integer_type_node, 2); decl = start_var_decl (array_type, "_OBJC_ImageInfo"); @@ -2788,7 +2788,7 @@ next_sjlj_build_try_catch_finally (struct objc_try_context **ctcp) /* Build the complete FINALLY statement list. */ t = next_sjlj_build_try_exit (ctcp); t = build_stmt (input_location, COND_EXPR, - c_common_truthvalue_conversion + c_common_truthvalue_conversion (input_location, rethrow_decl), NULL, t); SET_EXPR_LOCATION (t, cur_try_context->finally_locus); @@ -2801,7 +2801,7 @@ next_sjlj_build_try_catch_finally (struct objc_try_context **ctcp) t = build_function_call (input_location, objc_exception_throw_decl, t); t = build_stmt (input_location, COND_EXPR, - c_common_truthvalue_conversion (input_location, + c_common_truthvalue_conversion (input_location, rethrow_decl), t, NULL); SET_EXPR_LOCATION (t, cur_try_context->end_finally_locus); @@ -2924,7 +2924,7 @@ objc_build_exc_ptr (struct objc_try_context **cur_try_context) } } -static tree +static tree begin_catch (struct objc_try_context **cur_try_context, tree type, tree decl, tree compound, bool ellipsis ATTRIBUTE_UNUSED) { @@ -2941,13 +2941,13 @@ begin_catch (struct objc_try_context **cur_try_context, tree type, return build2 (MODIFY_EXPR, void_type_node, decl, t); } -static void +static void finish_catch (struct objc_try_context **cur_try_context, tree current_catch) { append_to_statement_list (current_catch, &((*cur_try_context)->catch_list)); } -static tree +static tree finish_try_stmt (struct objc_try_context **cur_try_context) { tree stmt; diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index f3cf359d19f..90660d75a98 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see . */ /* The NeXT ABI2 is used for m64 implementations on Darwin/OSX machines. - + This version is intended to match (logically) the output of Apple's 4.2.1 compiler. */ @@ -85,7 +85,7 @@ extern char *util_firstobj; #define OBJC2_CLS_HAS_CXX_STRUCTORS 0x0004L enum objc_v2_tree_index -{ +{ /* Templates. */ OCTI_V2_CLS_TEMPL, OCTI_V2_CAT_TEMPL, @@ -95,7 +95,7 @@ enum objc_v2_tree_index OCTI_V2_IVAR_LIST_TEMPL, OCTI_V2_MESSAGE_REF_TEMPL, OCTI_V2_SUPER_MESSAGE_REF_TEMPL, - + OCTI_V2_MESSAGE_SELECTOR_TYPE, OCTI_V2_SUPER_MESSAGE_SELECTOR_TYPE, OCTI_V2_IMP_TYPE, @@ -105,7 +105,7 @@ enum objc_v2_tree_index OCTI_V2_VTABLE_DECL, OCTI_V2_PROPERTY_TEMPL, - + /* V2 messaging. */ OCTI_V2_UMSG_FIXUP_DECL, OCTI_V2_UMSG_STRET_FIXUP_DECL, @@ -113,12 +113,12 @@ enum objc_v2_tree_index OCTI_V2_UMSG_ID_STRET_FIXUP_DECL, OCTI_V2_UMSG_SUPER2_FIXUP_DECL, OCTI_V2_UMSG_SUPER2_STRET_FIXUP_DECL, - + /* Exceptions - related. */ OCTI_V2_BEGIN_CATCH_DECL, OCTI_V2_END_CATCH_DECL, OCTI_V2_RETHROW_DECL, - + OCTI_V2_MAX }; @@ -132,21 +132,21 @@ enum objc_v2_tree_index /* struct message_ref_t */ #define objc_v2_message_ref_template \ - objc_v2_global_trees[OCTI_V2_MESSAGE_REF_TEMPL] + objc_v2_global_trees[OCTI_V2_MESSAGE_REF_TEMPL] #define objc_v2_ivar_list_ptr objc_v2_global_trees[OCTI_V2_IVAR_LIST_TEMPL] /* struct super_message_ref_t */ #define objc_v2_super_message_ref_template \ - objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_REF_TEMPL] + objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_REF_TEMPL] /* struct message_ref_t* */ -#define objc_v2_selector_type objc_v2_global_trees[OCTI_V2_MESSAGE_SELECTOR_TYPE] +#define objc_v2_selector_type objc_v2_global_trees[OCTI_V2_MESSAGE_SELECTOR_TYPE] /* struct super_super_message_ref_t */ #define objc_v2_super_selector_type \ - objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_SELECTOR_TYPE] + objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_SELECTOR_TYPE] #define objc_v2_imp_type objc_v2_global_trees[OCTI_V2_IMP_TYPE] -#define objc_v2_super_imp_type objc_v2_global_trees[OCTI_V2_SUPER_IMP_TYPE] +#define objc_v2_super_imp_type objc_v2_global_trees[OCTI_V2_SUPER_IMP_TYPE] #define UOBJC_V2_CACHE_decl objc_v2_global_trees[OCTI_V2_CACHE_DECL] #define UOBJC_V2_VTABLE_decl objc_v2_global_trees[OCTI_V2_VTABLE_DECL] @@ -158,14 +158,14 @@ enum objc_v2_tree_index /* V2 Messaging */ /* objc_msgSend_fixup_rtp */ -#define umsg_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_FIXUP_DECL] +#define umsg_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_FIXUP_DECL] /* objc_msgSend_stret_fixup_rtp */ -#define umsg_stret_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_STRET_FIXUP_DECL] +#define umsg_stret_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_STRET_FIXUP_DECL] /* objc_msgSendId_fixup_rtp */ -#define umsg_id_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_ID_FIXUP_DECL] +#define umsg_id_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_ID_FIXUP_DECL] /* objc_msgSendId_stret_fixup_rtp */ #define umsg_id_stret_fixup_decl \ - objc_v2_global_trees[OCTI_V2_UMSG_ID_STRET_FIXUP_DECL] + objc_v2_global_trees[OCTI_V2_UMSG_ID_STRET_FIXUP_DECL] /* objc_msgSendSuper2_fixup_rtp */ #define umsg_id_super2_fixup_decl \ objc_v2_global_trees[OCTI_V2_UMSG_SUPER2_FIXUP_DECL] @@ -237,7 +237,7 @@ static tree finish_try_stmt (struct objc_try_context **); static GTY ((length ("SIZEHASHTABLE"))) hash *extern_names; -bool +bool objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks) { extern_names = ggc_alloc_cleared_vec_hash (SIZEHASHTABLE); @@ -245,7 +245,7 @@ objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks) if (flag_objc_exceptions && flag_objc_sjlj_exceptions) { inform (UNKNOWN_LOCATION, "%<-fobjc-sjlj-exceptions%> is ignored for " - "%<-fnext-runtime%> when %<-fobjc-abi-version%> >= 2"); + "%<-fnext-runtime%> when %<-fobjc-abi-version%> >= 2"); flag_objc_sjlj_exceptions = 0; } @@ -289,7 +289,7 @@ objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks) /* We need a way to convey what kind of meta-data are represented by a given variable, since each type is expected (by the runtime) to be found in a specific named section. The solution must be usable with LTO. - + The scheme used for NeXT ABI 0/1 (partial matching of variable names) is not satisfactory when LTO is used with ABI-2. We now tag ObjC meta-data with identification attributes in the front end. The back-end may choose to act @@ -315,7 +315,7 @@ next_runtime_abi_02_init_metadata_attributes (void) meta_clac_meth = meta_clai_meth = meta_catc_meth = - meta_cati_meth = + meta_cati_meth = meta_proto_cls_meth = meta_proto_nst_meth = meta_base; @@ -371,14 +371,14 @@ static void next_runtime_02_initialize (void) objc_v2_selector_type. */ build_v2_message_ref_templates (); - objc_v2_ivar_list_ptr = - build_pointer_type (xref_tag (RECORD_TYPE, + objc_v2_ivar_list_ptr = + build_pointer_type (xref_tag (RECORD_TYPE, get_identifier ("_ivar_list_t"))); - objc_prop_list_ptr = + objc_prop_list_ptr = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier ("_prop_list_t"))); - + build_v2_class_templates (); build_v2_super_template (); build_v2_protocol_template (); @@ -406,14 +406,14 @@ static void next_runtime_02_initialize (void) NULL, NULL_TREE); TREE_NOTHROW (umsg_id_fixup_decl) = 0; - /* id objc_msgSendId_stret_fixup_rtp + /* id objc_msgSendId_stret_fixup_rtp (id, struct message_ref_t*, ...); */ umsg_id_stret_fixup_decl = add_builtin_function ("objc_msgSendId_stret_fixup", type, 0, NOT_BUILT_IN, NULL, NULL_TREE); TREE_NOTHROW (umsg_id_stret_fixup_decl) = 0; - /* id objc_msgSendSuper2_fixup_rtp + /* id objc_msgSendSuper2_fixup_rtp (struct objc_super *, struct message_ref_t*, ...); */ type = build_varargs_function_type_list (objc_object_type, objc_super_type, @@ -424,16 +424,16 @@ static void next_runtime_02_initialize (void) NULL, NULL_TREE); TREE_NOTHROW (umsg_id_super2_fixup_decl) = 0; - /* id objc_msgSendSuper2_stret_fixup_rtp + /* id objc_msgSendSuper2_stret_fixup_rtp (struct objc_super *, struct message_ref_t*, ...); */ - umsg_id_super2_stret_fixup_decl = + umsg_id_super2_stret_fixup_decl = add_builtin_function ("objc_msgSendSuper2_stret_fixup", - type, 0, NOT_BUILT_IN, + type, 0, NOT_BUILT_IN, NULL, NULL_TREE); TREE_NOTHROW (umsg_id_super2_stret_fixup_decl) = 0; /* Present in the library, but unused by the FE. */ - /* Protocol *objc_getProtocol (const char *) + /* Protocol *objc_getProtocol (const char *) type = build_function_type_list (objc_protocol_type, const_string_type_node, NULL_TREE); @@ -452,12 +452,12 @@ static void next_runtime_02_initialize (void) type = build_function_type_list (objc_object_type, const_string_type_node, NULL_TREE); - objc_get_class_decl = add_builtin_function (TAG_GETCLASS, + objc_get_class_decl = add_builtin_function (TAG_GETCLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE); /* id objc_getMetaClass (const char *); */ - objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS, + objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE); @@ -466,13 +466,13 @@ static void next_runtime_02_initialize (void) type = build_function_type_list (void_type_node, ptr_type_node, const_ptr_type_node, - ptrdiff_type_node, + ptrdiff_type_node, boolean_type_node, boolean_type_node, NULL_TREE); /* Declare the following function: void - objc_copyStruct (void *destination, const void *source, + objc_copyStruct (void *destination, const void *source, ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ objc_copyStruct_decl = add_builtin_function ("objc_copyStruct", type, 0, NOT_BUILT_IN, @@ -508,7 +508,7 @@ static void next_runtime_02_initialize (void) TREE_NOTHROW (objc2_end_catch_decl) = 0; /* void objc_exception_rethrow (void) */ - objc_rethrow_exception_decl = + objc_rethrow_exception_decl = add_builtin_function ("objc_exception_rethrow", type, 0, NOT_BUILT_IN, NULL, NULL_TREE); @@ -552,12 +552,12 @@ build_v2_message_ref_templates (void) objc_start_struct (get_identifier ("_message_ref_t")); /* IMP messenger; */ - ptr_message_ref_t = - build_pointer_type (xref_tag (RECORD_TYPE, + ptr_message_ref_t = + build_pointer_type (xref_tag (RECORD_TYPE, get_identifier ("_message_ref_t"))); - objc_v2_imp_type = - build_pointer_type (build_function_type_list + objc_v2_imp_type = + build_pointer_type (build_function_type_list (objc_object_type, objc_object_type, ptr_message_ref_t, @@ -578,12 +578,12 @@ build_v2_message_ref_templates (void) objc_start_struct (get_identifier ("_super_message_ref_t")); /* SUPER_IMP messenger; */ - ptr_message_ref_t = build_pointer_type - (xref_tag (RECORD_TYPE, + ptr_message_ref_t = build_pointer_type + (xref_tag (RECORD_TYPE, get_identifier ("_super_message_ref_t"))); - objc_v2_super_imp_type = - build_pointer_type (build_function_type_list + objc_v2_super_imp_type = + build_pointer_type (build_function_type_list (objc_object_type, objc_super_type, ptr_message_ref_t, @@ -595,7 +595,7 @@ build_v2_message_ref_templates (void) add_field_decl (objc_selector_type, "name", &chain); objc_finish_struct (objc_v2_super_message_ref_template, decls); - objc_v2_super_selector_type = + objc_v2_super_selector_type = build_pointer_type (objc_v2_super_message_ref_template); } @@ -624,7 +624,7 @@ struct class_t struct class_t *superclass; void *cache; IMP *vtable; - + ...When this is active - it will point to a rw version, but when we build the meta-data we point it to the ro... struct class_ro_t *data; @@ -639,7 +639,7 @@ build_v2_class_templates (void) tree decls, *chain = NULL; /* struct class_ro_t {...} */ - objc_v2_class_ro_template = + objc_v2_class_ro_template = objc_start_struct (get_identifier (UTAG_V2_CLASS_RO)); /* uint32_t const flags; */ @@ -667,13 +667,13 @@ build_v2_class_templates (void) add_field_decl (objc_method_list_ptr, "baseMethods", &chain); /* const struct objc_protocol_list *const baseProtocols; */ - add_field_decl (build_pointer_type - (xref_tag (RECORD_TYPE, + add_field_decl (build_pointer_type + (xref_tag (RECORD_TYPE, get_identifier (UTAG_V2_PROTOCOL_LIST))), "baseProtocols", &chain); /* const struct ivar_list_t *const ivars; */ - add_field_decl (objc_v2_ivar_list_ptr, "ivars", &chain); + add_field_decl (objc_v2_ivar_list_ptr, "ivars", &chain); /* const uint8_t * const weakIvarLayout; */ add_field_decl (cnst_strg_type, "weakIvarLayout", &chain); @@ -685,7 +685,7 @@ build_v2_class_templates (void) chain = NULL; /* struct class_t {...} */ - objc_v2_class_template = + objc_v2_class_template = objc_start_struct (get_identifier (UTAG_V2_CLASS)); /* struct class_t *isa; */ @@ -703,7 +703,7 @@ build_v2_class_templates (void) add_field_decl (build_pointer_type (objc_v2_imp_type), "vtable", &chain); /* struct class_ro_t *ro; */ - add_field_decl (build_pointer_type (objc_v2_class_ro_template), "ro", &chain); + add_field_decl (build_pointer_type (objc_v2_class_ro_template), "ro", &chain); objc_finish_struct (objc_v2_class_template, decls); } @@ -731,7 +731,7 @@ build_v2_super_template (void) /* struct protocol_t { - Class isa; + Class isa; const char * const protocol_name; const struct protocol_list_t * const protocol_list; const struct method_list_t * const instance_methods; @@ -748,7 +748,7 @@ build_v2_protocol_template (void) { tree decls, *chain = NULL; - objc_v2_protocol_template = + objc_v2_protocol_template = objc_start_struct (get_identifier (UTAG_V2_PROTOCOL)); /* Class isa; */ @@ -802,7 +802,7 @@ build_v2_category_template (void) { tree decls, *chain = NULL; - objc_v2_category_template = + objc_v2_category_template = objc_start_struct (get_identifier ("_category_t")); /* char *name; */ @@ -853,7 +853,7 @@ hash_name_lookup (hash *hashlist, tree name) table. Note that hashing is done on its inner IDENTIFIER_NODE node. */ -static void +static void hash_name_enter (hash *hashlist, tree id) { hash obj; @@ -878,7 +878,7 @@ create_extern_decl (tree type, const char *name) if (var) return var; /* New name. */ - var = start_var_decl (type, name); + var = start_var_decl (type, name); TREE_STATIC (var) = 0; DECL_EXTERNAL (var) = 1; TREE_PUBLIC (var) = 1; @@ -911,7 +911,7 @@ create_global_decl (tree type, const char *name) /* Create a symbol with __attribute__ ((visibility ("hidden"))) attribute (private extern). */ -static tree +static tree create_hidden_decl (tree type, const char *name) { tree decl = create_global_decl (type, name); @@ -939,7 +939,7 @@ next_runtime_abi_02_class_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s", + snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s", IDENTIFIER_POINTER (CLASS_NAME (klass))); /* ObjC2 classes are extern visible. */ decl = create_global_decl (objc_v2_class_template, buf); @@ -952,7 +952,7 @@ next_runtime_abi_02_metaclass_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s", + snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s", IDENTIFIER_POINTER (CLASS_NAME (klass))); /* ObjC2 classes are extern visible. */ decl = create_global_decl (objc_v2_class_template, buf); @@ -965,7 +965,7 @@ next_runtime_abi_02_category_decl (tree klass) { tree decl; char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s", + snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s", IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)), IDENTIFIER_POINTER (CLASS_NAME (klass))); decl = start_var_decl (objc_v2_category_template, buf); @@ -1005,7 +1005,7 @@ next_runtime_abi_02_string_decl (tree type, const char *name, string_section wh case prop_names_attr: OBJCMETA (var, objc_meta, meta_prop_name_attr); break; - default: + default: OBJCMETA (var, objc_meta, meta_base); break; } @@ -1136,7 +1136,7 @@ build_selector_reference_decl (tree ident) t = buf; while (*t) { - if (*t==':') + if (*t==':') *t = '$'; /* Underscore would clash between foo:bar and foo_bar. */ t++; } @@ -1189,7 +1189,7 @@ build_v2_message_reference_decl (tree sel_name, tree message_func_ident) t = buf; while (*t) { - if (*t==':') + if (*t==':') *t = '$'; /* Underscore would clash between foo:bar and foo_bar. */ t++; } @@ -1230,7 +1230,7 @@ build_v2_selector_messenger_reference (tree sel_name, tree message_func_decl) msgrefs = VEC_alloc (msgref_entry, gc, 32); /* We come here if we don't find a match or at the start. */ - decl = build_v2_message_reference_decl (sel_name, + decl = build_v2_message_reference_decl (sel_name, DECL_NAME (message_func_decl)); e.func = message_func_decl; e.selname = sel_name; @@ -1246,7 +1246,7 @@ build_v2_protocollist_ref_decl (tree protocol) tree protocol_ident = PROTOCOL_NAME (protocol); char buf[BUFSIZE]; - snprintf (buf, BUFSIZE, "_OBJC_ProtocolRef_%s", + snprintf (buf, BUFSIZE, "_OBJC_ProtocolRef_%s", IDENTIFIER_POINTER (protocol_ident)); /* TODO: other compiler versions make these hidden & weak. */ decl = create_global_decl (objc_protocol_type, buf); @@ -1316,7 +1316,7 @@ objc_is_ivar (tree expr, tree component, tree *klass) tree field = NULL_TREE; tree basetype = TYPE_MAIN_VARIANT (TREE_TYPE (expr)); - if (TREE_CODE (basetype) == RECORD_TYPE + if (TREE_CODE (basetype) == RECORD_TYPE && TYPE_HAS_OBJC_INFO (basetype) && TYPE_OBJC_INTERFACE (basetype)) { *klass = lookup_interface (OBJC_TYPE_NAME (basetype)); @@ -1337,7 +1337,7 @@ objc_is_ivar (tree expr, tree component, tree *klass) } } return field; -} +} static void create_ivar_offset_name (char *buf, tree class_name, tree field_decl) @@ -1380,13 +1380,13 @@ objc_v2_build_ivar_ref (tree datum, tree component) ftype = TREE_TYPE (field); /* (char*)datum */ - expr = build_c_cast (input_location, + expr = build_c_cast (input_location, string_type_node, build_fold_addr_expr (datum)); /* (char*)datum + offset */ - expr = fold_build2_loc (input_location, + expr = fold_build2_loc (input_location, POINTER_PLUS_EXPR, string_type_node, expr, offset); - + /* (ftype*)((char*)datum + offset) */ expr = build_c_cast (input_location, build_pointer_type (ftype), expr); @@ -1415,7 +1415,7 @@ objc_v2_build_ivar_ref (tree datum, tree component) on the fly. That is, unless they refer to (private) fields in the class stucture. */ static tree -next_runtime_abi_02_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, +next_runtime_abi_02_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, tree base, tree id) { tree ivar; @@ -1484,7 +1484,7 @@ next_runtime_abi_02_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED, } static tree -next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, +next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, struct imp_entry *imp, bool inst_meth) { /* ??? is this OK when zero-link = true? */ @@ -1496,16 +1496,16 @@ next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED, super_class = objc_get_class_reference (CLASS_NAME (imp->imp_template)); if (!inst_meth) - + /* If we are in a class method, we must retrieve the _metaclass_ for the current class, pointed at by the class's "isa" pointer. The following assumes that "isa" is the first ivar in a class (which it must be). */ - super_class = + super_class = build_indirect_ref (input_location, build_c_cast (input_location, build_pointer_type (objc_class_type), - super_class), + super_class), RO_UNARY_STAR); return super_class; } @@ -1551,13 +1551,13 @@ objc_copy_to_temp_side_effect_params (tree typelist, tree values) gcc_assert (TREE_CHAIN (typelist)); typetail = TREE_CHAIN (TREE_CHAIN (typelist)); - for (valtail = values; valtail; + for (valtail = values; valtail; valtail = TREE_CHAIN (valtail), typetail = TREE_CHAIN (typetail)) { tree value = TREE_VALUE (valtail); tree type = typetail ? TREE_VALUE (typetail) : NULL_TREE; if (type == NULL_TREE) - break; + break; if (!TREE_SIDE_EFFECTS (value)) continue; /* To prevent re-evaluation. */ @@ -1583,7 +1583,7 @@ build_v2_build_objc_method_call (int super_flag, tree method_prototype, = (method_prototype ? TREE_VALUE (TREE_TYPE (method_prototype)) : objc_object_type); - tree method_param_types = get_arg_type_list (method_prototype, + tree method_param_types = get_arg_type_list (method_prototype, METHOD_REF, super_flag); tree ftype = build_function_type (ret_type, method_param_types); @@ -1596,11 +1596,11 @@ build_v2_build_objc_method_call (int super_flag, tree method_prototype, sender_cast = build_pointer_type (ftype); if (check_for_nil) - method_params = objc_copy_to_temp_side_effect_params (method_param_types, + method_params = objc_copy_to_temp_side_effect_params (method_param_types, method_params); /* Get &message_ref_t.messenger. */ - sender = build_c_cast (input_location, + sender = build_c_cast (input_location, build_pointer_type (super_flag ? objc_v2_super_imp_type : objc_v2_imp_type), @@ -1638,19 +1638,19 @@ build_v2_build_objc_method_call (int super_flag, tree method_prototype, else ftree = fold_convert (ret_type, integer_zero_node); - ifexp = build_binary_op (input_location, NE_EXPR, - lookup_object, + ifexp = build_binary_op (input_location, NE_EXPR, + lookup_object, fold_convert (rcv_p, integer_zero_node), 1); #ifdef OBJCPLUS ret_val = build_conditional_expr (ifexp, ret_val, ftree, tf_warning_or_error); #else /* ??? CHECKME. */ - ret_val = build_conditional_expr (input_location, + ret_val = build_conditional_expr (input_location, ifexp, 1, ret_val, NULL_TREE, ftree, NULL_TREE); -#endif +#endif } return ret_val; } @@ -1668,54 +1668,54 @@ next_runtime_abi_02_build_objc_method_call (location_t loc, tree message_func_decl; bool check_for_nil = flag_objc_nilcheck; - ret_type = (method_prototype ? - TREE_VALUE (TREE_TYPE (method_prototype)) : - objc_object_type); + ret_type = method_prototype + ? TREE_VALUE (TREE_TYPE (method_prototype)) + : objc_object_type; /* Do we need to check for nil receivers ? */ /* For now, message sent to classes need no nil check. In the future, class declaration marked as weak_import must be nil checked. */ - if (super - || (TREE_CODE (receiver) == VAR_DECL + if (super + || (TREE_CODE (receiver) == VAR_DECL && TREE_TYPE (receiver) == objc_class_type)) check_for_nil = false; if (!targetm.calls.struct_value_rtx (0, 0) - && (TREE_CODE (ret_type) == RECORD_TYPE - || TREE_CODE (ret_type) == UNION_TYPE) + && (TREE_CODE (ret_type) == RECORD_TYPE + || TREE_CODE (ret_type) == UNION_TYPE) && targetm.calls.return_in_memory (ret_type, 0)) { if (super) message_func_decl = umsg_id_super2_stret_fixup_decl; else - message_func_decl = objc_is_id (rtype) - ? umsg_id_stret_fixup_decl - : umsg_stret_fixup_decl; + message_func_decl = objc_is_id (rtype) + ? umsg_id_stret_fixup_decl + : umsg_stret_fixup_decl; } else { if (super) message_func_decl = umsg_id_super2_fixup_decl; else - message_func_decl = objc_is_id (rtype) - ? umsg_id_fixup_decl - : umsg_fixup_decl; + message_func_decl = objc_is_id (rtype) + ? umsg_id_fixup_decl + : umsg_fixup_decl; } - selector = build_v2_selector_messenger_reference (sel_name, + selector = build_v2_selector_messenger_reference (sel_name, message_func_decl); /* selector = &_msg; */ selector = build_unary_op (loc, ADDR_EXPR, selector, 0); - - selector = build_c_cast (loc, (super ? objc_v2_super_selector_type + + selector = build_c_cast (loc, (super ? objc_v2_super_selector_type : objc_v2_selector_type), selector); /* (*_msg.messenger) (receiver, &_msg, ...); */ return build_v2_build_objc_method_call (super, method_prototype, - receiver, selector, + receiver, selector, method_params, check_for_nil); } @@ -1739,7 +1739,7 @@ next_runtime_abi_02_setup_const_string_class_decl (void) available yet (in fact it is not in most cases). So, declare an extern OBJC_CLASS_$_NSConstantString in its place. */ if (!string_class_decl) - string_class_decl = + string_class_decl = create_extern_decl (objc_v2_class_template, IDENTIFIER_POINTER (constant_string_global_id)); @@ -1781,7 +1781,7 @@ next_runtime_abi_02_build_const_string_constructor (location_t loc, tree string, struct _prop_t { const char * const name; // property name - const char * const attributes; // comma-delimited, encoded, + const char * const attributes; // comma-delimited, encoded, // property attributes }; */ @@ -1823,7 +1823,7 @@ build_v2_ivar_t_template (void) objc_ivar_record = objc_start_struct (objc_ivar_id); /* unsigned long int *offset; */ - decls = add_field_decl (build_pointer_type + decls = add_field_decl (build_pointer_type (TREE_TYPE (size_zero_node)), "offset", &chain); /* char *name; */ @@ -1850,7 +1850,7 @@ build_metadata_templates (void) objc_method_template = build_method_template (); if (!objc_v2_property_template) - objc_v2_property_template = build_v2_property_template (); + objc_v2_property_template = build_v2_property_template (); if (!objc_v2_ivar_template) objc_v2_ivar_template = build_v2_ivar_t_template (); @@ -1865,8 +1865,8 @@ static char * objc_build_internal_classname (tree ident, bool metaclass) { static char string[512]; - snprintf (string, 512, "%s_%s", metaclass ? "OBJC_METACLASS_$" - : "OBJC_CLASS_$", + snprintf (string, 512, "%s_%s", metaclass ? "OBJC_METACLASS_$" + : "OBJC_CLASS_$", IDENTIFIER_POINTER (ident)); return string; } @@ -1889,11 +1889,11 @@ newabi_append_ro (const char *name) return string; } -/* Build the struct message_ref_t msg = - {objc_msgSend_fixup_xxx, @selector(func)} +/* Build the struct message_ref_t msg = + {objc_msgSend_fixup_xxx, @selector(func)} table. */ -static +static void build_v2_message_ref_translation_table (void) { int count; @@ -1919,7 +1919,7 @@ void build_v2_message_ref_translation_table (void) expr = build_selector (ref->selname); CONSTRUCTOR_APPEND_ELT (initializer, NULL_TREE, expr); constructor = objc_build_constructor (struct_type, initializer); - finish_var_decl (ref->refdecl, constructor); + finish_var_decl (ref->refdecl, constructor); } } @@ -1949,7 +1949,7 @@ build_v2_classrefs_table (void) expr = convert (objc_class_type, build_fold_addr_expr (expr)); } /* The runtime wants this, even if it appears unused, so we must force the - output. + output. DECL_PRESERVE_P (decl) = 1; */ finish_var_decl (decl, expr); } @@ -1991,7 +1991,7 @@ build_v2_super_classrefs_table (bool metaclass) static GTY(()) VEC(tree,gc) *class_list; -static void +static void objc_v2_add_to_class_list (tree global_class_decl) { if (!class_list) @@ -2004,7 +2004,7 @@ static GTY(()) VEC(tree,gc) *nonlazy_class_list; /* Add the global class meta-data declaration to the list which later on ends up in the __nonlazy_class section. */ -static void +static void objc_v2_add_to_nonlazy_class_list (tree global_class_decl) { if (!nonlazy_class_list) @@ -2017,7 +2017,7 @@ static GTY(()) VEC(tree,gc) *category_list; /* Add the category meta-data declaration to the list which later on ends up in the __nonlazy_category section. */ -static void +static void objc_v2_add_to_category_list (tree decl) { if (!category_list) @@ -2030,7 +2030,7 @@ static GTY(()) VEC(tree,gc) *nonlazy_category_list; /* Add the category meta-data declaration to the list which later on ends up in the __category_list section. */ -static void +static void objc_v2_add_to_nonlazy_category_list (tree decl) { if (!nonlazy_category_list) @@ -2077,7 +2077,7 @@ build_v2_address_table (VEC(tree,gc) *src, const char *nam, tree attr) CONSTRUCTOR_APPEND_ELT (initlist, purpose, expr); } gcc_assert (count > 0); - type = build_array_type (objc_class_type, + type = build_array_type (objc_class_type, build_index_type (build_int_cst (NULL_TREE, count - 1))); decl = start_var_decl (type, nam); /* The runtime wants this, even if it appears unused, so we must @@ -2097,7 +2097,7 @@ build_v2_protocol_list_translation_table (void) { int count; prot_list_entry *ref; - + if (!protrefs) return; @@ -2106,7 +2106,7 @@ build_v2_protocol_list_translation_table (void) char buf[BUFSIZE]; tree expr; gcc_assert (TREE_CODE (ref->id) == PROTOCOL_INTERFACE_TYPE); - snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s", + snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (ref->id))); expr = start_var_decl (objc_v2_protocol_template, buf); expr = convert (objc_protocol_type, build_fold_addr_expr (expr)); @@ -2210,15 +2210,15 @@ generate_v2_protocol_list (tree i_or_p, tree klass_ctxt) switch (TREE_CODE (i_or_p)) { case PROTOCOL_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s", + snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s", IDENTIFIER_POINTER (PROTOCOL_NAME (i_or_p))); break; case CLASS_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s", + snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s", IDENTIFIER_POINTER (CLASS_NAME (i_or_p))); break; case CATEGORY_INTERFACE_TYPE: - snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s", + snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s", IDENTIFIER_POINTER (CLASS_NAME (klass_ctxt)), IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass_ctxt))); break; @@ -2231,7 +2231,7 @@ generate_v2_protocol_list (tree i_or_p, tree klass_ctxt) /* ObjC2 puts all these in the base section. */ OBJCMETA (refs_decl, objc_meta, meta_base); DECL_PRESERVE_P (refs_decl) = 1; - finish_var_decl (refs_decl, + finish_var_decl (refs_decl, objc_build_constructor (TREE_TYPE (refs_decl),initlist)); return refs_decl; } @@ -2250,14 +2250,14 @@ build_v2_descriptor_table_initializer (tree type, tree entries) do { VEC(constructor_elt,gc) *eltlist = NULL; - CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE, build_selector (METHOD_SEL_NAME (entries))); - CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE, add_objc_string (METHOD_ENCODING (entries), meth_var_types)); CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE, null_pointer_node); - CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, objc_build_constructor (type, eltlist)); entries = TREE_CHAIN (entries); } @@ -2280,7 +2280,7 @@ build_v2_method_list_template (tree list_type, int size) tree array_type, decls, *chain = NULL; method_list_t_record = objc_start_struct (NULL_TREE); - + /* uint32_t const entsize; */ decls = add_field_decl (integer_type_node, "entsize", &chain); @@ -2298,7 +2298,7 @@ build_v2_method_list_template (tree list_type, int size) /* Note, as above that we are building to the objc_method_template which has the *imp field. ABI0/1 build with objc_method_prototype_template which is missing this field. */ -static tree +static tree generate_v2_meth_descriptor_table (tree chain, tree protocol, const char *prefix, tree attr) { @@ -2323,7 +2323,7 @@ generate_v2_meth_descriptor_table (tree chain, tree protocol, gcc_assert (size); method_list_template = build_v2_method_list_template (objc_method_template, size); - snprintf (buf, BUFSIZE, "%s_%s", prefix, + snprintf (buf, BUFSIZE, "%s_%s", prefix, IDENTIFIER_POINTER (PROTOCOL_NAME (protocol))); decl = start_var_decl (method_list_template, buf); @@ -2331,7 +2331,7 @@ generate_v2_meth_descriptor_table (tree chain, tree protocol, entsize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, entsize)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size)); - initlist = + initlist = build_v2_descriptor_table_initializer (objc_method_template, chain); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist); @@ -2361,11 +2361,11 @@ build_v2_property_table_initializer (tree type, tree context) later. */ tree attribute, name_ident = PROPERTY_NAME (x); - CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, add_objc_string (name_ident, prop_names_attr)); attribute = objc_v2_encode_prop_attr (x); - CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE, add_objc_string (attribute, prop_names_attr)); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, @@ -2392,7 +2392,7 @@ build_v2_property_list_template (tree list_type, int size) /* anonymous. */ property_list_t_record = objc_start_struct (NULL_TREE); - + /* uint32_t const entsize; */ decls = add_field_decl (integer_type_node, "entsize", &chain); @@ -2434,8 +2434,8 @@ generate_v2_property_table (tree context, tree klass_ctxt) if (size == 0) return NULL_TREE; - property_list_template = - build_v2_property_list_template (objc_v2_property_template, + property_list_template = + build_v2_property_list_template (objc_v2_property_template, size); initlist = build_v2_property_table_initializer (objc_v2_property_template, @@ -2452,9 +2452,9 @@ generate_v2_property_table (tree context, tree klass_ctxt) decl = start_var_decl (property_list_template, buf); - CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, build_int_cst (NULL_TREE, init_val)); - CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, build_int_cst (NULL_TREE, size)); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, initlist); @@ -2465,7 +2465,7 @@ generate_v2_property_table (tree context, tree klass_ctxt) static tree build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list, - tree inst_methods, tree class_methods, + tree inst_methods, tree class_methods, tree opt_ins_meth, tree opt_cls_meth, tree property_list) { @@ -2477,7 +2477,7 @@ build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list loc = UNKNOWN_LOCATION; /* This is NULL for the new ABI. */ - CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, convert (objc_object_type, null_pointer_node)); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, protocol_name); @@ -2516,7 +2516,7 @@ build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); /* const uint32_t size; = sizeof(struct protocol_t) */ - expr = build_int_cst (integer_type_node, + expr = build_int_cst (integer_type_node, TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_protocol_template))); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); /* const uint32_t flags; = 0 */ @@ -2558,12 +2558,12 @@ generate_v2_protocols (void) loc = DECL_SOURCE_LOCATION (decl); some = true; - inst_meth = + inst_meth = generate_v2_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p, "_OBJC_ProtocolInstanceMethods", meta_proto_nst_meth); - class_meth = + class_meth = generate_v2_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p, "_OBJC_ProtocolClassMethods", meta_proto_cls_meth); @@ -2573,7 +2573,7 @@ generate_v2_protocols (void) "_OBJC_OptProtocolInstMethods", meta_proto_nst_meth); - opt_class_meth = + opt_class_meth = generate_v2_meth_descriptor_table (PROTOCOL_OPTIONAL_CLS_METHODS (p), p, "_OBJC_OptProtocolClassMethods", meta_proto_cls_meth); @@ -2632,9 +2632,9 @@ generate_v2_dispatch_table (tree chain, const char *name, tree attr) decl = start_var_decl (method_list_template, name); init_val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template)); - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, init_val)); - CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, size)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist); @@ -2700,11 +2700,11 @@ generate_v2_category (struct imp_entry *impent) tree cat_decl = impent->class_decl; location_t loc; char buf[BUFSIZE]; - + loc = DECL_SOURCE_LOCATION (cat_decl); /* ??? not sure this is really necessary, the following references should - force appropriate linkage linkage... + force appropriate linkage linkage... -- but ... ensure a reference to the class... */ t = objc_v2_get_class_reference (CLASS_NAME (cat)); /* ... which we ignore so force it out.. */ @@ -2823,7 +2823,7 @@ build_v2_ivar_list_initializer (tree class_name, tree type, tree field_decl) { VEC(constructor_elt,gc) *inits = NULL; - do + do { VEC(constructor_elt,gc) *ivar = NULL; int val; @@ -2839,8 +2839,8 @@ build_v2_ivar_list_initializer (tree class_name, tree type, tree field_decl) /* Set offset. */ CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, build_unary_op (input_location, - ADDR_EXPR, - ivar_offset_ref (class_name, + ADDR_EXPR, + ivar_offset_ref (class_name, field_decl), 0)); /* Set name. */ @@ -2862,12 +2862,12 @@ build_v2_ivar_list_initializer (tree class_name, tree type, tree field_decl) /* Set alignment. */ val = DECL_ALIGN_UNIT (field_decl); val = exact_log2 (val); - CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, build_int_cst (integer_type_node, val)); - + /* Set size. */ val = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field_decl)); - CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, build_int_cst (integer_type_node, val)); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, @@ -2925,20 +2925,20 @@ generate_v2_ivars_list (tree chain, const char *name, tree attr, tree templ) tree decl, initlist, ivar_list_template; VEC(constructor_elt,gc) *inits = NULL; int size, ivar_t_size; - + if (!chain || !name || !(size = ivar_list_length (chain))) return NULL_TREE; generating_instance_variables = 1; ivar_list_template = build_v2_ivar_list_t_template (objc_v2_ivar_template, size); - + initlist = build_v2_ivar_list_initializer (CLASS_NAME (templ), objc_v2_ivar_template, chain); ivar_t_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_ivar_template)); - + decl = start_var_decl (ivar_list_template, name); - CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, build_int_cst (integer_type_node, ivar_t_size)); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, build_int_cst (integer_type_node, size)); @@ -2985,11 +2985,11 @@ build_v2_class_t_initializer (tree type, tree isa, tree superclass, /* Routine to build object of struct class_ro_t { ... }; */ static tree -build_v2_class_ro_t_initializer (tree type, tree name, +build_v2_class_ro_t_initializer (tree type, tree name, unsigned int flags, unsigned int instanceStart, - unsigned int instanceSize, - tree ivarLayout, - tree baseMethods, tree baseProtocols, + unsigned int instanceSize, + tree ivarLayout, + tree baseMethods, tree baseProtocols, tree ivars, tree property_list) { tree expr, unsigned_char_star, ltyp; @@ -3000,21 +3000,21 @@ build_v2_class_ro_t_initializer (tree type, tree name, loc = UNKNOWN_LOCATION; /* flags */ - CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, build_int_cst (integer_type_node, flags)); /* instanceStart */ - CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, build_int_cst (integer_type_node, instanceStart)); /* instanceSize */ - CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, build_int_cst (integer_type_node, instanceSize)); /* This ABI is currently only used on m64 NeXT. We always explicitly declare the alignment padding. */ /* reserved, pads alignment. */ - CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, build_int_cst (integer_type_node, 0)); /* ivarLayout */ @@ -3037,7 +3037,7 @@ build_v2_class_ro_t_initializer (tree type, tree name, CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, expr); /* baseProtocols */ - ltyp = build_pointer_type (xref_tag (RECORD_TYPE, + ltyp = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier (UTAG_V2_PROTOCOL_LIST))); if (baseProtocols) expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, baseProtocols, 0)); @@ -3055,7 +3055,7 @@ build_v2_class_ro_t_initializer (tree type, tree name, /* TODO: We don't yet have the weak/strong stuff... */ /* weakIvarLayout */ - CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, + CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, convert (unsigned_char_star, null_pointer_node)); /* property list */ @@ -3142,9 +3142,9 @@ generate_v2_class_structs (struct imp_entry *impent) } while (1); - /* {extern} struct class_t OBJC_METACLASS_$_ + /* {extern} struct class_t OBJC_METACLASS_$_ create extern if not already declared. */ - snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s", + snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s", IDENTIFIER_POINTER (CLASS_NAME (my_root_int))); root_expr = create_extern_decl (objc_v2_class_template, buf); root_expr = build_fold_addr_expr (root_expr); @@ -3153,12 +3153,12 @@ generate_v2_class_structs (struct imp_entry *impent) interface = lookup_interface (my_super_id); gcc_assert (interface); /* Similarly, for OBJC_CLASS_$_... */ - snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s", + snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s", IDENTIFIER_POINTER (CLASS_NAME (interface))); class_superclass_expr = create_extern_decl (objc_v2_class_template, buf); class_superclass_expr = build_fold_addr_expr (class_superclass_expr); /* ... and for OBJC_METACLASS_$_. */ - snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s", + snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s", IDENTIFIER_POINTER (CLASS_NAME (interface))); metaclass_superclass_expr = create_extern_decl (objc_v2_class_template, buf); metaclass_superclass_expr = build_fold_addr_expr (metaclass_superclass_expr); @@ -3188,7 +3188,7 @@ generate_v2_class_structs (struct imp_entry *impent) { snprintf (buf, BUFSIZE, "_OBJC_ClassMethods_%s", IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))); - class_methods = + class_methods = generate_v2_dispatch_table (CLASS_CLS_METHODS (impent->imp_context), buf, meta_clac_meth); } @@ -3203,7 +3203,7 @@ generate_v2_class_structs (struct imp_entry *impent) class_ivars = NULL_TREE; /* TODO: Add total size of class variables when implemented. */ - instanceSize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_class_template)); + instanceSize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_class_template)); /* So now build the META CLASS structs. */ /* static struct class_ro_t _OBJC_METACLASS_Foo = { ... }; */ @@ -3213,10 +3213,10 @@ generate_v2_class_structs (struct imp_entry *impent) (DECL_NAME (metaclass_decl)))); /* TODO: ivarLayout needs t be built. */ - initlist = + initlist = build_v2_class_ro_t_initializer (TREE_TYPE (decl), name_expr, (flags | cls_flags), instanceStart, - instanceSize, ivarLayout, + instanceSize, ivarLayout, class_methods, protocol_decl, class_ivars, NULL_TREE); /* The ROs sit in the default const section. */ @@ -3224,12 +3224,12 @@ generate_v2_class_structs (struct imp_entry *impent) finish_var_decl (decl, initlist); /* static struct class_t _OBJC_METACLASS_Foo = { ... }; */ - initlist = + initlist = build_v2_class_t_initializer (TREE_TYPE (metaclass_decl), root_expr, metaclass_superclass_expr, build_fold_addr_expr (decl), - build_fold_addr_expr (UOBJC_V2_CACHE_decl), + build_fold_addr_expr (UOBJC_V2_CACHE_decl), build_fold_addr_expr (UOBJC_V2_VTABLE_decl)); /* The class section attributes are set when they are created. */ finish_var_decl (metaclass_decl, initlist); @@ -3251,7 +3251,7 @@ generate_v2_class_structs (struct imp_entry *impent) { snprintf (buf, BUFSIZE, "_OBJC_InstanceMethods_%s", IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))); - inst_methods = + inst_methods = generate_v2_dispatch_table (CLASS_NST_METHODS (impent->imp_context), buf, meta_clai_meth); } @@ -3261,7 +3261,7 @@ generate_v2_class_structs (struct imp_entry *impent) { snprintf (buf, BUFSIZE, "_OBJC_InstanceIvars_%s", IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))); - inst_ivars = generate_v2_ivars_list (chain, buf, meta_clai_vars, + inst_ivars = generate_v2_ivars_list (chain, buf, meta_clai_vars, impent->imp_template); } @@ -3282,9 +3282,9 @@ generate_v2_class_structs (struct imp_entry *impent) while (field && TREE_CHAIN (field) && TREE_CODE (TREE_CHAIN (field)) == FIELD_DECL) field = TREE_CHAIN (field); - + if (field && TREE_CODE (field) == FIELD_DECL) - instanceSize = int_byte_position (field) * BITS_PER_UNIT + instanceSize = int_byte_position (field) * BITS_PER_UNIT + tree_low_cst (DECL_SIZE (field), 0); else instanceSize = 0; @@ -3294,19 +3294,19 @@ generate_v2_class_structs (struct imp_entry *impent) /* If the class has no ivars, instanceStart should be set to the superclass's instanceSize. */ - instanceStart = - (inst_ivars != NULL_TREE) ? (unsigned) int_byte_position (firstIvar) + instanceStart = + (inst_ivars != NULL_TREE) ? (unsigned) int_byte_position (firstIvar) : instanceSize; /* static struct class_ro_t _OBJC_CLASS_Foo = { ... }; */ - decl = start_var_decl (objc_v2_class_ro_template, + decl = start_var_decl (objc_v2_class_ro_template, newabi_append_ro (IDENTIFIER_POINTER - (DECL_NAME (class_decl)))); + (DECL_NAME (class_decl)))); - initlist = + initlist = build_v2_class_ro_t_initializer (TREE_TYPE (decl), name_expr, (flags | cls_flags), instanceStart, - instanceSize, ivarLayout, + instanceSize, ivarLayout, inst_methods, protocol_decl, inst_ivars, props); /* The ROs sit in the default const section. */ @@ -3318,8 +3318,8 @@ generate_v2_class_structs (struct imp_entry *impent) build_fold_addr_expr (metaclass_decl), class_superclass_expr, build_fold_addr_expr (decl), - build_fold_addr_expr (UOBJC_V2_CACHE_decl), - build_fold_addr_expr (UOBJC_V2_VTABLE_decl)); + build_fold_addr_expr (UOBJC_V2_CACHE_decl), + build_fold_addr_expr (UOBJC_V2_VTABLE_decl)); /* The class section attributes are set when they are created. */ finish_var_decl (class_decl, initlist); @@ -3356,12 +3356,12 @@ generate_v2_objc_image_info (void) { tree decl, array_type; VEC(constructor_elt,gc) *v = NULL; - int flags = + int flags = ((flag_replace_objc_classes && imp_count ? 1 : 0) | (flag_objc_gc ? 2 : 0)); flags |= 16; - + array_type = build_sized_array_type (integer_type_node, 2); decl = start_var_decl (array_type, "_OBJC_ImageInfo"); @@ -3416,13 +3416,13 @@ objc_generate_v2_next_metadata (void) build_v2_protocol_list_translation_table (); build_v2_protocol_list_address_table (); - build_v2_address_table (class_list, "_OBJC_ClassList$", + build_v2_address_table (class_list, "_OBJC_ClassList$", meta_label_classlist); - build_v2_address_table (category_list, "_OBJC_CategoryList$", + build_v2_address_table (category_list, "_OBJC_CategoryList$", meta_label_categorylist); - build_v2_address_table (nonlazy_class_list, "_OBJC_NonLazyClassList$", + build_v2_address_table (nonlazy_class_list, "_OBJC_NonLazyClassList$", meta_label_nonlazy_classlist); - build_v2_address_table (nonlazy_category_list, "_OBJC_NonLazyCategoryList$", + build_v2_address_table (nonlazy_category_list, "_OBJC_NonLazyCategoryList$", meta_label_nonlazy_categorylist); /* This conveys information on GC usage and zero-link. */ @@ -3515,7 +3515,7 @@ build_ehtype (tree name, const char *eh_name, bool weak) name_expr = add_objc_string (name, class_names); /* Extern ref. for the class. ??? Maybe we can look this up somewhere. */ - class_name_expr = + class_name_expr = create_extern_decl (objc_v2_class_template, objc_build_internal_classname (name, false)); class_name_expr = build_fold_addr_expr (class_name_expr); @@ -3541,10 +3541,10 @@ objc2_objc_exception_attr (tree cls) cls = lookup_interface (CLASS_SUPER_NAME (cls)); } - return false; + return false; } -static bool +static bool is_implemented (tree name) { struct imp_entry *t; @@ -3615,7 +3615,7 @@ next_runtime_02_eh_type (tree type) { /* This is provided by the Apple/NeXT libobjc.dylib so we need only to reference it. */ - next_v2_EHTYPE_id_decl = + next_v2_EHTYPE_id_decl = start_var_decl (objc_v2_ehtype_template, "OBJC_EHTYPE_id"); DECL_EXTERNAL (next_v2_EHTYPE_id_decl) = 1; TREE_PUBLIC (next_v2_EHTYPE_id_decl) = 1; @@ -3635,9 +3635,9 @@ next_runtime_02_eh_type (tree type) goto err_mark_in; #endif } - else + else t = OBJC_TYPE_NAME (TREE_TYPE (type)); - + /* We have to build a reference to the OBJC_EHTYPE_. */ t = lookup_ehtype_ref (t); if (!t) @@ -3724,7 +3724,7 @@ static tree begin_catch (struct objc_try_context **cur_try_context, tree type, } /* try { catch-body } finally { objc_end_catch (); } */ -static void +static void finish_catch (struct objc_try_context **cur_try_context, tree curr_catch) { struct objc_try_context *ct; @@ -3751,7 +3751,7 @@ finish_catch (struct objc_try_context **cur_try_context, tree curr_catch) } /* Pick up the new context we made in begin_try above... */ - ct = *cur_try_context; + ct = *cur_try_context; func = build_function_call_vec (loc, objc2_end_catch_decl, NULL, NULL); append_to_statement_list (func, &ct->finally_body); try_exp = build_stmt (loc, TRY_FINALLY_EXPR, ct->try_body, ct->finally_body); @@ -3761,7 +3761,7 @@ finish_catch (struct objc_try_context **cur_try_context, tree curr_catch) append_to_statement_list (curr_catch, &((*cur_try_context)->catch_list)); } -static tree +static tree finish_try_stmt (struct objc_try_context **cur_try_context) { struct objc_try_context *c = *cur_try_context; diff --git a/gcc/objc/objc-runtime-hooks.h b/gcc/objc/objc-runtime-hooks.h index b325e75f9bc..d2606ff0d98 100644 --- a/gcc/objc/objc-runtime-hooks.h +++ b/gcc/objc/objc-runtime-hooks.h @@ -1,6 +1,6 @@ /* Hooks to abstract the runtime meta-data generation for Objective C. Copyright (C) 2011 Free Software Foundation, Inc. - Contributed by Iain Sandoe + Contributed by Iain Sandoe This file is part of GCC. @@ -23,27 +23,27 @@ along with GCC; see the file COPYING3. If not see /* A set of hooks for the front end to obtain runtime-specific actions. */ -/* Objective-C supports several runtime library variants: +/* Objective-C supports several runtime library variants: "GNU" runtime selected by -fgnu-runtime (currently at ABI version 8). "NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin systems at API version 1 (for m32 code) and version 2 (for m64 code). - + The runtimes require different data types/layouts, method call mechanisms and so on, and the purpose of this interface is to abstract such differences from the parser's perspective. */ /* TODO: Do we want the initial underscore ? */ -typedef struct _objc_runtime_hooks_r +typedef struct _objc_runtime_hooks_r { /* TODO: Expand comments in this file. */ /* Initialize for this runtime. */ void (*initialize) (void); const char *default_constant_string_class_name; - + /* FIXME: Having to check this name should not be necessary. */ - const char *tag_getclass; + const char *tag_getclass; /* id for superclass class field - named differently in the existing runtimes. */ tree (*super_superclassfield_ident) (void); @@ -78,21 +78,21 @@ typedef struct _objc_runtime_hooks_r tree (*get_arg_type_list_base) (tree, int, int); /* Build method call. */ tree (*build_objc_method_call) (location_t, tree, tree, tree, tree, tree, int); - + /* Check for or otherwise handle a request to check that the constant string class reference is set-up & OK. */ bool (*setup_const_string_class_decl) (void); /* Return the tree reprenting a const string constructor for the arg. Most of the data are in global trees. */ tree (*build_const_string_constructor) (location_t, tree, int); - + /* Exceptions. */ tree (*build_throw_stmt) (location_t, tree, bool); tree (*build_exc_ptr) (struct objc_try_context **); tree (*begin_catch) (struct objc_try_context **, tree, tree, tree, bool); void (*finish_catch) (struct objc_try_context **, tree); tree (*finish_try_stmt) (struct objc_try_context **); - + /* Emit all the metadata required by the runtime - based on the tables built during parsing. */ void (*generate_metadata) (void); diff --git a/gcc/objc/objc-runtime-shared-support.c b/gcc/objc/objc-runtime-shared-support.c index 8dca6ccae9f..78505f4d5e8 100644 --- a/gcc/objc/objc-runtime-shared-support.c +++ b/gcc/objc/objc-runtime-shared-support.c @@ -159,8 +159,8 @@ build_selector (tree ident) /* struct _objc_super { struct _objc_object *self; - struct _objc_class *super_class; - [or Class cls; for the abi v2] + struct _objc_class *super_class; + [or Class cls; for the abi v2] }; */ void @@ -302,7 +302,7 @@ add_objc_string (tree ident, string_section section) { tree *chain, decl, type; char buf[BUFSIZE]; - + switch (section) { case class_names: @@ -336,13 +336,13 @@ add_objc_string (tree ident, string_section section) } type = build_sized_array_type (char_type_node, IDENTIFIER_LENGTH (ident) + 1); - /* Get a runtime-specific string decl which will be finish_var()'ed in + /* Get a runtime-specific string decl which will be finish_var()'ed in generate_strings (). */ decl = (*runtime.string_decl) (type, buf, section); TREE_CONSTANT (decl) = 1; *chain = tree_cons (decl, ident, NULL_TREE); - return convert (string_type_node, + return convert (string_type_node, build_unary_op (input_location, ADDR_EXPR, decl, 1)); } @@ -442,7 +442,7 @@ init_module_descriptor (tree type, long vers) /* No really useful place to point to. */ loc = UNKNOWN_LOCATION; - + /* version = { 1, ... } */ expr = build_int_cst (long_integer_type_node, vers); @@ -463,7 +463,7 @@ init_module_descriptor (tree type, long vers) /* symtab = { ..., _OBJC_SYMBOLS, ... } */ ltyp = build_pointer_type (xref_tag (RECORD_TYPE, - get_identifier (UTAG_SYMTAB))); + get_identifier (UTAG_SYMTAB))); if (UOBJC_SYMBOLS_decl) expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, UOBJC_SYMBOLS_decl, 0)); @@ -519,7 +519,7 @@ build_module_descriptor (long vers, tree attr) /* Allow the runtime to mark meta-data such that it can be assigned to target specific sections by the back-end. */ if (attr) - DECL_ATTRIBUTES (UOBJC_MODULES_decl) = attr; + DECL_ATTRIBUTES (UOBJC_MODULES_decl) = attr; finish_var_decl (UOBJC_MODULES_decl, init_module_descriptor (TREE_TYPE (UOBJC_MODULES_decl), @@ -640,7 +640,7 @@ build_next_selector_translation_table (void) if (warn_selector) { location_t loc; - if (decl) + if (decl) loc = DECL_SOURCE_LOCATION (decl); else loc = UNKNOWN_LOCATION; @@ -652,7 +652,7 @@ build_next_selector_translation_table (void) if (decl) { /* Entries of this form are used for references to methods. - The runtime re-writes these on start-up, but the compiler can't see + The runtime re-writes these on start-up, but the compiler can't see that and optimizes it away unless we force it. */ DECL_PRESERVE_P (decl) = 1; finish_var_decl (decl, expr); diff --git a/gcc/objc/objc-runtime-shared-support.h b/gcc/objc/objc-runtime-shared-support.h index 8e4693d6f09..ace9039552a 100644 --- a/gcc/objc/objc-runtime-shared-support.h +++ b/gcc/objc/objc-runtime-shared-support.h @@ -1,6 +1,6 @@ /* Support routines shared by all runtimes. Copyright (C) 2011 Free Software Foundation, Inc. - Contributed by Iain Sandoe + Contributed by Iain Sandoe This file is part of GCC. diff --git a/gcc/objc/objc-tree.def b/gcc/objc/objc-tree.def index 5833e6ae787..9086d22571c 100644 --- a/gcc/objc/objc-tree.def +++ b/gcc/objc/objc-tree.def @@ -64,7 +64,7 @@ DEFTREECODE (CLASS_REFERENCE_EXPR, "class_reference_expr", tcc_expression, 1) it and we just need to swap Operand 2 in, and emit the deprecation warnings from Operand 3 if needed. - Please note that when the Objective-C 2.0 "dot-syntax" 'object.component' + Please note that when the Objective-C 2.0 "dot-syntax" 'object.component' is encountered, where 'component' is not a property but there are valid setter/getter methods for it, an artificial PROPERTY_DECL is generated and used in the PROPERTY_REF. */