[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: Merge objc-improvements-branch to mainline

From: David Ayers
Subject: Re: PATCH: Merge objc-improvements-branch to mainline
Date: Wed, 24 Sep 2003 21:56:34 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030827

Ziemowit Laski wrote:

(1) Bug fixes (as evidenced by the numerous new test cases vs. mainline) (2) Support for new Mac OS X (NeXT) runtime features, accessible via -fobjc-exceptions, -fno-nil-receivers, -fzero-link and -freplace-objc-classes, all of which have been documented in gcc/doc/invoke.texi. Test cases are included (and made
      Darwin-specific when appropriate).
(3) Retrofit of DejaGNU ObjC test suite so that most tests are usable with
      both NeXT and GNU runtimes.
(4) Very humble beginnings of Objective-C++ support (e.g., stub-objc.c, more
      #ifdef OBJCPLUS fragments in objc-act.c).

I deduce from this, that ObjC++ should also live in c-parse.in and objc-act.c. :-/ I'll have a closer look once it's on the branch, but I must say I'm not too thrilled about effectively supporting three front ends in this conglomerate of files. If this is currently necessary to avoid code duplication, I'm not going to attempt block it. But we should try to find a way to separate the front ends and somehow share common code soon.

I shall wait 24 hours for feedback,

The branch is still missing Alex's patch. Therefore we are seeing some inappropriate (but I believe harmless on all architectures) warnings about: GSObjCRuntime.m:1497: Warning: `Class' may not respond to `+methodForSelector:' GSObjCRuntime.m:1497: Warning: (Messages without a matching method signature
GSObjCRuntime.m:1497: Warning: will be assumed to return `id' and accept
GSObjCRuntime.m:1497: Warning: `...' as arguments.)
GSObjCRuntime.m:1497: Warning: assignment from incompatible pointer type

(The method is declared as an instance method on a root class.)

I care little about whether this gets fixed on the branch or on mainline and gets merged back later, but it should get fixed soon.

and then commit this under my newly-acquired Objective-C mullah powers.

This ChangeLog is very lengthy and covers all kinds of changes. Some of the cleanups are very welcome. Some parts I'm somewhere between indifferent and undecided. Others I don't think belong into the compiler but should be left for libraries to implement (but Alex already mentioned that). Plus there are more formal issues about introducing changes that seem to belong in ObjC++ support and not in this initial 'ObjC' only merge. There seem to be a few new non-portable implementation (which is currently NeXT runtime only). These should be addressed individually, so that we can find portable solutions for the GNU Runtime where applicable. (Plus formating issues here and there, especially the test cases.)

Would it be possible to split this merge into coherent patches, individually RFC'ed and applied to mainline? As time permits I'm willing help extract them from the branch.

  Here and there, the patch does touch non-ObjC files,
but in a very straighforward manner.

2003-09-23  Ziemowit Laski  <address@hidden>

    * Makefile.in (C_OBJS): Add in stub-objc.o.
    (c-parse.y): Change sed demarcations to begin with '@@'.
    (stub-objc.o): New rule.
* c-common.c (flag_nil_receivers, flag_objc_exceptions, flag_zero_link,
    flag_replace_objc_classes): New flags.
    RID_AT_SYNCHRONIZED): New keywords.
    (flag_nil_receivers, flag_objc_exceptions, flag_zero_link,
    flag_replace_objc_classes): New flags.
(lookup_interface, is_class_name, objc_is_object_ptr, objc_check_decl,
    objc_comptypes, objc_message_selector, lookup_objc_ivar,
    get_current_scope, objc_mark_locals_volatile): New prototypes,
    some moved from c-tree.h.
* c-decl.c (get_current_scope, objc_mark_locals_volatile): New functions.
    (finish_decl): Adjust where objc_check_decl() gets called.
* c-lang.c (lookup_interface, is_class_name, objc_is_id, objc_check_decl, objc_comptypes, objc_message_selector, lookup_objc_ivar): Remove stubs. * c-opts.c (c_common_handle_option): Add handling for flag_nil_receivers,
    flag_objc_exceptions, flag_replace_objc_classes and flag_zero_link.
* c-parse.in: Replace 'ifc' and 'end ifc' sed markers with '@@ifc' and
    '@@end_ifc', respectively.
    (objc_try_stmt, superclass, class_ivars, objc_try_catch-stmt,
    objc_finally_block): New rules.
    (component_decl_list2): Clean up semantic action for @defs construct.
    (component_decl, c99_block_start): Remove call to add_objc_decls().
    (poplevel): Add call to objc_clear_super_receiver().
(stmt): Add rules for @throw, @address@hidden@finally and @synchronized
    (classdef, methodprotolist): Clean up/simplify.
    (methodprotolist2): Eliminate.
    (methodproto): Call add_method() instead of add_class_method() and
    (receiver): Add TYPENAME production.
(reswords): Add "throw", "try", "catch", "finally" and "synchronized".
    (rid_to_yy): Add AT_THROW, AT_TRY, AT_CATCH, AT_FINALLY and
* c-tree.h (lookup_interface, is_class_name, objc_is_id, objc_check_decl,
    objc_comptypes, objc_message_selector)
    * c-typeck.c (comptypes): In ObjC mode, call objc_comptypes() for
    struct and pointer    types.
    (build_c_cast): Do not discard ObjC protocol qualifiers.
    (convert_for_assignment): Cache result of comp_target_types() instead
    of calling it more than once.
    * c.opt (fnext-runtime): Update description string.
(fnil-receivers, fobjc-exceptions, freplace-objc-classes, fzero-link):
    New ObjC/ObjC++-specific flags.
    * function.h (GCC_FUNCTION_H): Header guard.
    * gengtype-lex.l: Teach lexer about new @@... sed demarcations.
    * stub-objc.c: New file, to be used to satisfy references to ObjC
    functions by the C and C++ front-ends.
    * config/darwin.c (_OBJC_IMAGE_INFO): New global metadata.
    * config/darwin.h (FUNCTION): Add in_objc_image_info.
    (SECTION_FUNCTION): Add objc_image_info_section.
    * doc/invoke.texi: Link to GCC web site for Objective-C information.
    (-fconstant-string-class): Update documentation.
    (-fno-nil-receivers, -fobjc-exceptions, -freplace-objc-classes,
    -fzero-link): New documentation.
    * objc/Make-lang.in (objc-parse.y): Change sed demarcations to begin
    with '@@'.
    * objc/lang-specs.h (@objective-c-header): Fix -E spec.
    * objc/objc/objc-act.c: Replace TYPE_NAME with OBJC_TYPE_NAME
    throughout; provide casts for return values from memory allocation
    functions (xmalloc, alloca, ggc_alloc, etc.).
    (OBJC_VOID_AT_END): New macro.
    (rtl.h): Do not #include any more.
    TAG_SYNCENTER, TAG_SYNCEXIT): New NeXT runtime entry points.
(struct val_stack, catch_count_stack, exc_binding_stack, val_stack_push,
    val_stack_pop): New.
    (objc_check_decl): Fix precondition for error message, along with
    the message itself.
    (lookup_and_install_protocols): Remove nonexistent protocols from
    protocol list instead of returning error_mark_node.
    (create_builtin_decl): Use DECL_ARTIFICIAL only for VAR_DECLs.
    (setup_string_decl): Generalize to use STRING_OBJECT_GLOBAL_FORMAT.
    (synth_module_prologue): General clean-up; construct NeXT-specific
    runtime API prototypes if needed.
    (build_string_class_template): Remove.
    (check_string_class_template, string_layout_checked): New.
    (build_objc_string_object): Generalize to work with
    (build_objc_symtab_template): Fix layout for the NeXT runtime.
    (build_metadata_decl): New.
    (forward_declare_categories): Call build_metadata_decl() instead of
    create_builtin_decl() et al.
    (build_module_descriptor): Use OBJC_VOID_AT_END instead of
    (build_selector_reference_decl, build_class_reference_decl,
    build_objc_string_decl): Do not set TREE_READONLY.
    (get_proto_encoding): Do not call hack_method_prototype().
    (get_class_reference): Add failure mode for invalid class names;
    support -fzero-link; defer if in an ObjC++ template declaration.
    (objc_declare_alias, objc_declare_class): Fix up duplicate name
    lookup; check for global scope if in ObjC++.
(is_class_name): Generalize to work with various tree nodes (TYPE_DECL,
    (objc_is_id): Removed.
    (objc_is_object_ptr): New function.
    (get_class_ivars_from_name): New function, used for @defs construct.
    (get_class_ivars): Add option to return raw ivars; create a
    ClASS_OWN_IVARS list for each class as needed.
    (objc_enter_block, objc_exit_block, objc_declare_variable,
    objc_build_throw_stmt, val_stack_push, val_stack_pop,
    objc_build_try_enter_fragment, objc_build_extract_expr,
    objc_build_try_exit_fragment, objc_build_extract_fragment,
    objc_build_try_prologue, objc_build_try_epilogue,
    objc_build_catch_stmt, objc_build_catch_epilogue,
    objc_build_finally_prologue, objc_build_finally_epilogue,
    objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue,
    objc_build_synchronized_epilogue, build_objc_exception_stuff):
    New functions.
    (_JBLEN): _setjmp jmpbuf size (needs to be made a target hook in
    the future).
    (build_private_template): Fix up calls to get_class_ivars().
    (offset_is_register, forwarding_offset): Remove.
    (objc_method_parm_type, objc_encoded_type_size): New functions.
    (encode_method_prototype): Simplify to no longer depend on
    back-end information.
    (build_tmp_function_decl_xxx, build_tmp_function_decl,
    hack_method_prototype): Removed.
    (generate_protocol_references): Remove calls to
    (generate_protocols): Adjust calls to encode_method_prototype().
    (build_class_template): Generate sel_id' and 'gc_object_type' fields
    for the NeXT runtime.
    (synth_forward_declarations): Call build_metadata_decl().
    (check_ivars): Check that the number of ivars matches also.
    (build_super_template): Modify super_type directly; disable debugging
    output while generating decl.
    (build_ivar_list_initializer): Skip list elements that are not
    (ivar_list_length): New function.
(generate_ivar_lists): Call ivar_list_length() instead of list_length()
    and encode_method_prototype() instead of encode_method_def().
    (build_shared_structure_initializer): Generate 'sel_id' field for
    the NeXT runtime.
    (generate_category): Do not set TREE_USED.
    (build_keyword_selector): Ditto; transform into a function argument
    (get_arg_type_list): If there are no user-specified arguments, use
    '...'; use OBJC_VOID_AT_END.
    (check_duplicates): Add a parameter indicating whether methods or
    selectors are being checked.
    (receiver_is_class_object): Add parameters indicating whether
    receiver is 'self' or 'super'; robustify.
    (build_message_expr): Defer call to finish_message_expr() if
    inside an ObjC++ template.
    (lookup_method_in_hash_lists): New function.
    (finish_message_expr): Complete rewrite/fix.
    (build_objc_method_call): Ditto; factor out commonalities between
    the GNU and NeXT runtimes; acccommodate ..._stret and ...NonNil
    messenger variants on the NeXT.
    (lookup_instance_method_static, lookup_class_method_static):
    Fold into a single lookup_method_static() function with an
    additional parameter.
    (add_class_method, add_instance_method): Fold into a single
    add_method() function with an additional parameter.
    (add_category): Make duplicate categories a hard error in ObjC++.
    (add_instance_variable): Properly handle unnamed ivars, arrays of
    zero    or no size and bitfields.  In ObjC++, check for nontrivial
    C++ class instances.
    (is_public): Allow C functions to access address@hidden ivars, with
    a warning.
    (start_class): Move common initializations to
    synth_module_prologue(); check for global scope if in ObjC++.
    (continue_class): Fix calls to finish_struct().
    (objc_declare_protocols, start_protocol): Check for global scope
    if in ObjC++.
    (encode_pointer): Encode 'BOOL *' specially on the NeXT.
    (encode_aggregate_within): Rewrite to properly distinguish
    struct tags from typedefs in both ObjC and ObjC++.
    (encode_bitfield, encode_complete_bitfield): Remove.
    (encode_next_bitfield, encode_gnu_bitfield): New functions.
    (encode_field_decl): Call encode_next_bitfield() or
    encode_gnu_bitfield() as needed.
    (synth_self_and_ucmd_args): New function.
    (start_method_def): Use it.
    (objc_types_are_equivalent): New function.
    (comp_proto_with_proto): Use it instead of comptypes(), since
    we need symmetry.
    (really_start_method): Use lookup_method_static() instead of
    lookup_class_method_static() and lookup_instance_method_static();
    Emit 'extern "C"' if in ObjC++ mode.
    (add_objc_decls): Removed.
    (UOBJC_SUPER_scope): New variable.
    (get_super_receiver): Move construction of 'super' from
    add_objc_decls(); remove dependency on struct objc_class.
    (encode_method_def): Removed; encode_method_prototype() is
    used instead.
    (objc_clear_super_receiver): New function.
    (objc_expand_function_end): Do not do anything for ordinary
    C functions.
    (finish_method_def): Mark ObjC methods as un-inlinable.
    (gen_declaration_1): Emit widths of bitfields.
    (finish_objc): Call generate_objc_image_info() if needed;
    use check_duplicates() when checking for selector duplicates.
    (generate_objc_image_info): New function.
    * objc/objc-act.h (add_instance_method, add_class_method,
    get_class_ivars): Remove prototypes.
    (objc_build_throw_stmt, objc_build_try_catch_finally_stmt,
    objc_build_synchronized_prologue, objc_build_synchronized_epilogue,
    objc_build_catch_stmt, objc_build_catch_epilogue,
    objc_build_finally_prologue, objc_build_finally_epilogue,
    add_method, get_class_ivars_from_name): New prototypes.
    (TYPE_PROTOCOL_LIST): Robustify to distinguish from
    (OBJC_TYPE_NAME): New.
    (objc_tree_code): Ensure that either <c-tree.h> or <cp/cp-tree.h>
    got included.
    (IS_SUPER): Robustify.
    (umsg_stret_decl, umsg_super_stret_decl, umsg_nonnil_decl,
umsg_nonnil_stret_decl, objc_storage_class, objc_exception_extract_decl,
    objc_exception_try_enter_decl, objc_exception_try_exit_decl,
    objc_exception_match_decl, objc_exception_throw_decl,
objc_sync_enter_decl, objc_sync_exit_decl, objc_exception_data_template,
    objc_setjmp_decl, objc_stack_exception_data, objc_caught_exception,
    objc_rethrow_exception, objc_eval_once, objc_exception_block_stack,
    objc_catch_type): New ObjC/ObjC++ roots.
    * objc/objc-tree.def (MESSAGE_SEND_EXPR, CLASS_REFERENCE_EXPR): New
    ObjC/ObjC++ tree node codes.

    * lib/objc.exp (objc_target_compile): Do not point at libobjc headers
    if libobjc has not been built.
    * objc/execute/IMP.m, objc/execute/_cmd.m, objc/execute/bf-common.h,
objc/execute/bycopy-3.m, objc/execute/class-{1-14}.m, objc/execute/class-self-2.m, objc/execute/many_args_method.m, objc/execute/nested-3.m, objc/execute/np-2.m,
    objc/execute/object_is_class.m, objc/execute/object_is_meta_class.m,
    objc/execute/redefining_self.m, objc/execute/root_methods.m,
objc/execute/static-{1-2}.m, objc/execute/string-{1-4}.m, objc/execute/va_method.m, objc.dg/comp-types-4.m, objc.dg/headers.m: objc.dg/special/unclaimed-category-1.h, objc.dg/special/unclaimed-category-1.m: Make usable with NeXT as well as GNU runtime. * execute/next_mapping.h: New header, for GNU->NeXT impedance matching. * execute/cascading-1.m, execute/function-message-1.m, objc.dg/anon-1.m, objc.dg/bitfield-{3-4}.m, objc.dg/call-super-{1-3}.m, objc.dg/category-1.m, objc.dg/const-str-{3-6}.m, objc.dg/encode-{1-4}.m, objc.dg/func-ptr-1.m, objc.dg/gnu-runtime-1.m, objc.dg/image-info.m, objc.dg/method-{3-12}.m, objc.dg/missing-proto-{1-3}.m, objc.dg/nested-func-1.m, objc.dg/proto-lossage-2.m, objc.dg/proto-qual-1.m, objc.dg/sizeof-1.m, objc.dg/static-1.m, objc.dg/symtab-1.m, objc.dg/try-catch-{1-4}.m, objc.dg/type-size-{1-2}.m, objc.dg/zero-link-{1-2}.m:
    New test cases.
    * objc.dg/bitfield-2.m: Run only on Darwin.
    * objc.dg/class-2.m, objc.dg/comp-types-1.m, objc.dg/desig-init-1.m,
objc.dg/method-{1-2}.m, objc.dg/proto-hier-1.m, objc.dg/proto-lossage-1.m:
    Adjust for message wording changes.
    * objc.dg/const-str-1.m: Fix constant string layout.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]